From ricardo.trindade at emation.pt Mon Apr 4 09:17:23 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue Mar 14 23:21:58 2006 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot Message-ID: <42515A83.4050907@emation.pt> Hi, I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most recent stable snapshot), and get the following exception : It looks like rxtx has been compiled with jdk 1.5. If this was indeed the case, I think there is a compilation flag that generates code that runs on older jdks. java.lang.UnsupportedClassVersionError: gnu/io/UnsupportedCommOperationException (Unsupported major.minor version 49.0) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at java.net.URLClassLoader.defineClass(URLClassLoader.java:251) at java.net.URLClassLoader.access$100(URLClassLoader.java:55) at java.net.URLClassLoader$1.run(URLClassLoader.java:194) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:187) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:141) I'm trying to run it with 1.4. thanks Ricardo From taj at www.linux.org.uk Tue Apr 5 00:48:12 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue Mar 14 23:21:58 2006 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42515A83.4050907@emation.pt> References: <42515A83.4050907@emation.pt> Message-ID: On Mon, 4 Apr 2005, Ricardo Trindade wrote: > Hi, > > I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most > recent stable snapshot), and get the following exception : > > It looks like rxtx has been compiled with jdk 1.5. If this was > indeed the case, I think there is a compilation flag that generates code > that runs on older jdks. > > java.lang.UnsupportedClassVersionError: > gnu/io/UnsupportedCommOperationException (Unsupported major.minor > version 49.0) [snip] Thanks Ricardo I recompiled the jar with javac -source 1.3 -target 1.3. That should cover most of the JRE's in use today. I also compiled the rxtx 2.0 x86_64 native library which appeared to be missing. I tried looking for flags to pass gcc 4.0 to make the native libraries more backwards compatible but only found options for C++ which is not used in rxtx. I've got a list of other bugs that I'll be going through in the next few weeks but for now I just left them with the same CVS filename - no code changes. ftp://ftp.qbang.org/pub/rxtx/rxtx-2.0-CVS-20050120-bins.tar.gz ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-CVS-20050120-bins.tar.gz -- Trent Jarvi taj@www.linux.org.uk From ricardo.trindade at emation.pt Tue Apr 5 02:24:33 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue Mar 14 23:21:58 2006 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: References: <42515A83.4050907@emation.pt> Message-ID: <42524B41.3040300@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050405/5919abbb/attachment.html From taj at www.linux.org.uk Tue Apr 5 03:00:29 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue Mar 14 23:21:58 2006 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42524B41.3040300@emation.pt> References: <42515A83.4050907@emation.pt> <42524B41.3040300@emation.pt> Message-ID: On Tue, 5 Apr 2005, Ricardo Trindade wrote: > Will you anounce to the list when a new release is available ? > There will be several incremental releases announced here. Once those are done, we will release 2.1.7 and 2.0.7. -- Trent Jarvi taj@www.linux.org.uk From no_spam at somewhere.com Tue Apr 5 11:55:37 2005 From: no_spam at somewhere.com (no_spam@somewhere.com) Date: Tue Mar 14 23:21:58 2006 Subject: [Rxtx] Closing a port from an event listener results in a deadlock Message-ID: <20050405175537.GA21747@rcog.homelinux.net> On the message I sent on March 14, does anyone had the chance to try the modification? Or was it already fixed? (I haven't searched the archive extensively) Or maybe my message got catched by some spam filters? (it made it to the list archive though) Anyway, I would appreciate some feedback (through the list) Thanks From taj at www.linux.org.uk Tue Apr 5 14:42:28 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue Mar 14 23:21:58 2006 Subject: [Rxtx] Closing a port from an event listener results in a deadlock In-Reply-To: <20050405175537.GA21747@rcog.homelinux.net> References: <20050405175537.GA21747@rcog.homelinux.net> Message-ID: On Tue, 5 Apr 2005 no_spam@somewhere.com wrote: > On the message I sent on March 14, does anyone had the chance to try the > modification? > > Or was it already fixed? (I haven't searched the archive extensively) > > Or maybe my message got catched by some spam filters? (it made it to the list > archive though) > > Anyway, I would appreciate some feedback (through the list) > The patch is here http://marc.theaimsgroup.com/?l=rxtx&m=111084488820288&w=2 I have applied this patch to a local copy but will not be doing formal testing for a couple weeks. I do not try to close ports from inside the eventListenter usually so I encourage any feedback also. If there are no problems reported, I expect this will go into rxtx 2.1-7. -- Trent Jarvi taj@www.linux.org.uk From ricardo.trindade at emation.pt Wed Apr 6 08:33:42 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue Mar 14 23:21:58 2006 Subject: [Rxtx] getting RXTX version Message-ID: <4253F346.50102@emation.pt> Hi, I want to make sure my deployments have the same version of RXTX jar and native lib. I know the version of the jar can be obtained in the Version class, but how can I obtain the native version ? I know RXTX prints to the console a warning if the version is different. Is there a way to programatically know is this is the case ? I would like to log that to our app's log thanks Ricardo From taj at www.linux.org.uk Wed Apr 6 15:10:20 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue Mar 14 23:21:58 2006 Subject: [Rxtx] getting RXTX version In-Reply-To: <4253F346.50102@emation.pt> References: <4253F346.50102@emation.pt> Message-ID: On Wed, 6 Apr 2005, Ricardo Trindade wrote: > Hi, > > I want to make sure my deployments have the same version of RXTX jar > and native lib. > > I know the version of the jar can be obtained in the Version class, > but how can I obtain the native version ? > > I know RXTX prints to the console a warning if the version is > different. Is there a way to programatically know is this is the case ? > > I would like to log that to our app's log > There isn't a suggested way of doing that right now. We could move things around and have a static String RXTXVersion.getNativeVersion() in future releases. Is this what you expected? This is not documented in commapi at all. I just tossed that in to catch conflicts while developing. It would be nice to have access in GUI applications though. It may be possible to access RXTXCommDriver.LibVersion right now. -- Trent Jarvi taj@www.linux.org.uk From ricardo.trindade at emation.pt Thu Apr 7 02:51:00 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue Mar 14 23:21:58 2006 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> Message-ID: <4254F474.7020905@emation.pt> >There isn't a suggested way of doing that right now. We could move things >around and have a static String RXTXVersion.getNativeVersion() in future >releases. Is this what you expected? > > Yes, that would be perfect. >This is not documented in commapi at all. I just tossed that in to catch >conflicts while developing. It would be nice to have access in GUI >applications though. > >It may be possible to access RXTXCommDriver.LibVersion right now. > > > I tried, and I don't think it's possible. From taj at www.linux.org.uk Thu Apr 7 03:32:04 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue Mar 14 23:21:58 2006 Subject: [Rxtx] getting RXTX version In-Reply-To: <4254F474.7020905@emation.pt> References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: On Thu, 7 Apr 2005, Ricardo Trindade wrote: > > >There isn't a suggested way of doing that right now. We could move things > >around and have a static String RXTXVersion.getNativeVersion() in future > >releases. Is this what you expected? > > > > > > Yes, that would be perfect. > The attached should do what you want. You will still need to catch an exception for older versions... -- Trent Jarvi taj@www.linux.org.uk -------------- next part -------------- ? public_version.patch Index: RXTXCommDriver.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXCommDriver.java,v retrieving revision 1.16.2.51 diff -u -r1.16.2.51 RXTXCommDriver.java --- RXTXCommDriver.java 12 Oct 2004 09:13:30 -0000 1.16.2.51 +++ RXTXCommDriver.java 7 Apr 2005 09:29:04 -0000 @@ -54,7 +54,7 @@ the Library. */ String JarVersion = RXTXVersion.getVersion(); - String LibVersion = nativeGetVersion(); + String LibVersion = RXTXVersion.nativeGetVersion(); if ( devel ) { System.out.println("Devel Library"); @@ -76,7 +76,6 @@ /** Get the Serial port prefixes for the running OS */ private String deviceDirectory; private String osName; - private static native String nativeGetVersion(); private native boolean registerKnownPorts(int PortType); private native boolean isPortPrefixValid(String dev); private native boolean testRead(String dev, int type); Index: RXTXVersion.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXVersion.java,v retrieving revision 1.2.2.31 diff -u -r1.2.2.31 RXTXVersion.java --- RXTXVersion.java 16 Oct 2004 16:20:35 -0000 1.2.2.31 +++ RXTXVersion.java 7 Apr 2005 09:29:04 -0000 @@ -36,6 +36,7 @@ private static String Version; static { + System.loadLibrary( "rxtxSerial" ); Version = "RXTX-2.1-7pre20"; } /** @@ -47,4 +48,5 @@ { return(Version); } + public static native String nativeGetVersion(); } Index: SerialImp.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v retrieving revision 1.46.2.181 diff -u -r1.46.2.181 SerialImp.c --- SerialImp.c 17 Oct 2004 09:48:56 -0000 1.46.2.181 +++ SerialImp.c 7 Apr 2005 09:29:07 -0000 @@ -116,6 +116,7 @@ * It will eventually be removed. * */ #define RXTXPort(foo) Java_gnu_io_RXTXPort_ ## foo +#define RXTXVersion(foo) Java_gnu_io_RXTXVersion_ ## foo #define RXTXCommDriver(foo) Java_gnu_io_RXTXCommDriver_ ## foo #if defined(__sun__) || defined(__hpux__) @@ -4001,7 +4002,7 @@ } /*---------------------------------------------------------- -RXTXCommDriver.nativeGetVersion +RXTXVersion.nativeGetVersion accept: none perform: return the current version @@ -4010,9 +4011,10 @@ comments: This is used to avoid mixing versions of the .jar and native library. First introduced in rxtx-1.5-9 + Moved from RXTXCommDriver to RXTXVersion in rxtx-2.1-7 ----------------------------------------------------------*/ -JNIEXPORT jstring JNICALL RXTXCommDriver(nativeGetVersion) (JNIEnv *env, +JNIEXPORT jstring JNICALL RXTXVersion(nativeGetVersion) (JNIEnv *env, jclass jclazz ) { return (*env)->NewStringUTF( env, "RXTX-2.1-7pre20" ); From ricardo.trindade at emation.pt Thu Apr 7 03:45:58 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue Mar 14 23:21:58 2006 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: <42550156.2040908@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050407/05212451/attachment.html From thomas.shulok at lmco.com Thu Apr 7 17:43:11 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Tue Mar 14 23:21:58 2006 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi There, I'm attempting to talk RS232 between an embedded Linux box and a Windows box. Everything connects up fine, and I can send and receive a simple sequence of bytes with no problems. However, if around 5 seconds goes by without me sending something, I get the following when I attempt to send. java.io.IOException: Input/output error in writeArray Stack trace: java/lang/Throwable.()V java/lang/Throwable.(Ljava/lang/String;)V java/io/IOException.(Ljava/lang/String;)V gnu/io/RXTXPort.writeArray([BIIZ)V gnu/io/RXTXPort$SerialOutputStream.write([B)V SerialTest.main([Ljava/lang/String;)V If there interval is shorter (say 2 seconds between sends), I have no problems. On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and librxtxSerial-2.0.7pre2.so. Any ideas? Thanks, Thom -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5b23dcf/attachment.html From taj at www.linux.org.uk Thu Apr 7 19:22:36 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue Mar 14 23:21:58 2006 Subject: [Rxtx] Input/output error in writeArray In-Reply-To: References: Message-ID: On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a Windows > box. Everything connects up fine, and I can send and receive a simple > sequence of bytes with no problems. However, if around 5 seconds goes > by without me sending something, I get the following when I attempt to > send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj@www.linux.org.uk From taj at www.linux.org.uk Thu Apr 7 19:24:59 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue Mar 14 23:21:58 2006 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) Message-ID: hmm. This would not work from applets would it? -- Trent Jarvi taj@www.linux.org.uk ---------- Forwarded message ---------- Date: Thu, 07 Apr 2005 16:05:53 -0400 From: Chris Gaffney To: taj@www.linux.org.uk Subject: RXTX Libraries on Classpath fix Hi, I submitted a patch for RXTX a few weeks ago to allow for loading the native libraries from the classpath. Since sending it to you I found it wasn't working on windows. I've fixed the problem and created a new patch that should replace the older one. The actual change is a one line from a String.equals() to a String.startsWith(). Thanks for a great piece of software, -Chris Gaffney Grand Valley State University -------------- next part -------------- A non-text attachment was scrubbed... Name: libraries_on_classpath_fixed.patch Type: text/x-patch Size: 5617 bytes Desc: Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5d423b8/libraries_on_classpath_fixed.bin From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Tue Mar 14 23:21:58 2006 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj@www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj@www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx@mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Tue Mar 14 23:21:58 2006 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj@www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj@www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx@mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From thomas.shulok at lmco.com Fri Apr 8 10:38:55 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Tue Mar 14 23:21:58 2006 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi Trent, Thanks for the prompt response. Before diving deeper, I was wondering if there is a timeout parameter somewhere in the stack that I have not set properly. Given the nature of the failure (only fails if the line has been idle for a few seconds), it feels like some kind of timeout issue... Thanks again, Thom -----Original Message----- From: rxtx-bounces@mail.linuxgrrls.org [mailto:rxtx-bounces@mail.linuxgrrls.org] On Behalf Of Trent Jarvi Sent: Thursday, April 07, 2005 6:23 PM To: Java RXTX discussion Subject: Re: [Rxtx] Input/output error in writeArray On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a > Windows box. Everything connects up fine, and I can send and receive > a simple sequence of bytes with no problems. However, if around 5 > seconds goes by without me sending something, I get the following when > I attempt to send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj@www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx@mail.linuxgrrls.org http://mail.linuxgrrls.org/mailman/listinfo/rxtx From ricardo.trindade at emation.pt Mon Apr 4 09:17:23 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue Mar 28 18:25:21 2006 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot Message-ID: <42515A83.4050907@emation.pt> Hi, I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most recent stable snapshot), and get the following exception : It looks like rxtx has been compiled with jdk 1.5. If this was indeed the case, I think there is a compilation flag that generates code that runs on older jdks. java.lang.UnsupportedClassVersionError: gnu/io/UnsupportedCommOperationException (Unsupported major.minor version 49.0) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at java.net.URLClassLoader.defineClass(URLClassLoader.java:251) at java.net.URLClassLoader.access$100(URLClassLoader.java:55) at java.net.URLClassLoader$1.run(URLClassLoader.java:194) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:187) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:141) I'm trying to run it with 1.4. thanks Ricardo From taj at www.linux.org.uk Tue Apr 5 00:48:12 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue Mar 28 18:25:21 2006 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42515A83.4050907@emation.pt> References: <42515A83.4050907@emation.pt> Message-ID: On Mon, 4 Apr 2005, Ricardo Trindade wrote: > Hi, > > I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most > recent stable snapshot), and get the following exception : > > It looks like rxtx has been compiled with jdk 1.5. If this was > indeed the case, I think there is a compilation flag that generates code > that runs on older jdks. > > java.lang.UnsupportedClassVersionError: > gnu/io/UnsupportedCommOperationException (Unsupported major.minor > version 49.0) [snip] Thanks Ricardo I recompiled the jar with javac -source 1.3 -target 1.3. That should cover most of the JRE's in use today. I also compiled the rxtx 2.0 x86_64 native library which appeared to be missing. I tried looking for flags to pass gcc 4.0 to make the native libraries more backwards compatible but only found options for C++ which is not used in rxtx. I've got a list of other bugs that I'll be going through in the next few weeks but for now I just left them with the same CVS filename - no code changes. ftp://ftp.qbang.org/pub/rxtx/rxtx-2.0-CVS-20050120-bins.tar.gz ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-CVS-20050120-bins.tar.gz -- Trent Jarvi taj@www.linux.org.uk From ricardo.trindade at emation.pt Tue Apr 5 02:24:33 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue Mar 28 18:25:21 2006 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: References: <42515A83.4050907@emation.pt> Message-ID: <42524B41.3040300@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050405/5919abbb/attachment-0001.html From taj at www.linux.org.uk Tue Apr 5 03:00:29 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue Mar 28 18:25:21 2006 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42524B41.3040300@emation.pt> References: <42515A83.4050907@emation.pt> <42524B41.3040300@emation.pt> Message-ID: On Tue, 5 Apr 2005, Ricardo Trindade wrote: > Will you anounce to the list when a new release is available ? > There will be several incremental releases announced here. Once those are done, we will release 2.1.7 and 2.0.7. -- Trent Jarvi taj@www.linux.org.uk From no_spam at somewhere.com Tue Apr 5 11:55:37 2005 From: no_spam at somewhere.com (no_spam@somewhere.com) Date: Tue Mar 28 18:25:21 2006 Subject: [Rxtx] Closing a port from an event listener results in a deadlock Message-ID: <20050405175537.GA21747@rcog.homelinux.net> On the message I sent on March 14, does anyone had the chance to try the modification? Or was it already fixed? (I haven't searched the archive extensively) Or maybe my message got catched by some spam filters? (it made it to the list archive though) Anyway, I would appreciate some feedback (through the list) Thanks From taj at www.linux.org.uk Tue Apr 5 14:42:28 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue Mar 28 18:25:21 2006 Subject: [Rxtx] Closing a port from an event listener results in a deadlock In-Reply-To: <20050405175537.GA21747@rcog.homelinux.net> References: <20050405175537.GA21747@rcog.homelinux.net> Message-ID: On Tue, 5 Apr 2005 no_spam@somewhere.com wrote: > On the message I sent on March 14, does anyone had the chance to try the > modification? > > Or was it already fixed? (I haven't searched the archive extensively) > > Or maybe my message got catched by some spam filters? (it made it to the list > archive though) > > Anyway, I would appreciate some feedback (through the list) > The patch is here http://marc.theaimsgroup.com/?l=rxtx&m=111084488820288&w=2 I have applied this patch to a local copy but will not be doing formal testing for a couple weeks. I do not try to close ports from inside the eventListenter usually so I encourage any feedback also. If there are no problems reported, I expect this will go into rxtx 2.1-7. -- Trent Jarvi taj@www.linux.org.uk From ricardo.trindade at emation.pt Wed Apr 6 08:33:42 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue Mar 28 18:25:21 2006 Subject: [Rxtx] getting RXTX version Message-ID: <4253F346.50102@emation.pt> Hi, I want to make sure my deployments have the same version of RXTX jar and native lib. I know the version of the jar can be obtained in the Version class, but how can I obtain the native version ? I know RXTX prints to the console a warning if the version is different. Is there a way to programatically know is this is the case ? I would like to log that to our app's log thanks Ricardo From taj at www.linux.org.uk Wed Apr 6 15:10:20 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue Mar 28 18:25:21 2006 Subject: [Rxtx] getting RXTX version In-Reply-To: <4253F346.50102@emation.pt> References: <4253F346.50102@emation.pt> Message-ID: On Wed, 6 Apr 2005, Ricardo Trindade wrote: > Hi, > > I want to make sure my deployments have the same version of RXTX jar > and native lib. > > I know the version of the jar can be obtained in the Version class, > but how can I obtain the native version ? > > I know RXTX prints to the console a warning if the version is > different. Is there a way to programatically know is this is the case ? > > I would like to log that to our app's log > There isn't a suggested way of doing that right now. We could move things around and have a static String RXTXVersion.getNativeVersion() in future releases. Is this what you expected? This is not documented in commapi at all. I just tossed that in to catch conflicts while developing. It would be nice to have access in GUI applications though. It may be possible to access RXTXCommDriver.LibVersion right now. -- Trent Jarvi taj@www.linux.org.uk From ricardo.trindade at emation.pt Thu Apr 7 02:51:00 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue Mar 28 18:25:21 2006 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> Message-ID: <4254F474.7020905@emation.pt> >There isn't a suggested way of doing that right now. We could move things >around and have a static String RXTXVersion.getNativeVersion() in future >releases. Is this what you expected? > > Yes, that would be perfect. >This is not documented in commapi at all. I just tossed that in to catch >conflicts while developing. It would be nice to have access in GUI >applications though. > >It may be possible to access RXTXCommDriver.LibVersion right now. > > > I tried, and I don't think it's possible. From taj at www.linux.org.uk Thu Apr 7 03:32:04 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue Mar 28 18:25:21 2006 Subject: [Rxtx] getting RXTX version In-Reply-To: <4254F474.7020905@emation.pt> References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: On Thu, 7 Apr 2005, Ricardo Trindade wrote: > > >There isn't a suggested way of doing that right now. We could move things > >around and have a static String RXTXVersion.getNativeVersion() in future > >releases. Is this what you expected? > > > > > > Yes, that would be perfect. > The attached should do what you want. You will still need to catch an exception for older versions... -- Trent Jarvi taj@www.linux.org.uk -------------- next part -------------- ? public_version.patch Index: RXTXCommDriver.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXCommDriver.java,v retrieving revision 1.16.2.51 diff -u -r1.16.2.51 RXTXCommDriver.java --- RXTXCommDriver.java 12 Oct 2004 09:13:30 -0000 1.16.2.51 +++ RXTXCommDriver.java 7 Apr 2005 09:29:04 -0000 @@ -54,7 +54,7 @@ the Library. */ String JarVersion = RXTXVersion.getVersion(); - String LibVersion = nativeGetVersion(); + String LibVersion = RXTXVersion.nativeGetVersion(); if ( devel ) { System.out.println("Devel Library"); @@ -76,7 +76,6 @@ /** Get the Serial port prefixes for the running OS */ private String deviceDirectory; private String osName; - private static native String nativeGetVersion(); private native boolean registerKnownPorts(int PortType); private native boolean isPortPrefixValid(String dev); private native boolean testRead(String dev, int type); Index: RXTXVersion.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXVersion.java,v retrieving revision 1.2.2.31 diff -u -r1.2.2.31 RXTXVersion.java --- RXTXVersion.java 16 Oct 2004 16:20:35 -0000 1.2.2.31 +++ RXTXVersion.java 7 Apr 2005 09:29:04 -0000 @@ -36,6 +36,7 @@ private static String Version; static { + System.loadLibrary( "rxtxSerial" ); Version = "RXTX-2.1-7pre20"; } /** @@ -47,4 +48,5 @@ { return(Version); } + public static native String nativeGetVersion(); } Index: SerialImp.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v retrieving revision 1.46.2.181 diff -u -r1.46.2.181 SerialImp.c --- SerialImp.c 17 Oct 2004 09:48:56 -0000 1.46.2.181 +++ SerialImp.c 7 Apr 2005 09:29:07 -0000 @@ -116,6 +116,7 @@ * It will eventually be removed. * */ #define RXTXPort(foo) Java_gnu_io_RXTXPort_ ## foo +#define RXTXVersion(foo) Java_gnu_io_RXTXVersion_ ## foo #define RXTXCommDriver(foo) Java_gnu_io_RXTXCommDriver_ ## foo #if defined(__sun__) || defined(__hpux__) @@ -4001,7 +4002,7 @@ } /*---------------------------------------------------------- -RXTXCommDriver.nativeGetVersion +RXTXVersion.nativeGetVersion accept: none perform: return the current version @@ -4010,9 +4011,10 @@ comments: This is used to avoid mixing versions of the .jar and native library. First introduced in rxtx-1.5-9 + Moved from RXTXCommDriver to RXTXVersion in rxtx-2.1-7 ----------------------------------------------------------*/ -JNIEXPORT jstring JNICALL RXTXCommDriver(nativeGetVersion) (JNIEnv *env, +JNIEXPORT jstring JNICALL RXTXVersion(nativeGetVersion) (JNIEnv *env, jclass jclazz ) { return (*env)->NewStringUTF( env, "RXTX-2.1-7pre20" ); From ricardo.trindade at emation.pt Thu Apr 7 03:45:58 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue Mar 28 18:25:21 2006 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: <42550156.2040908@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050407/05212451/attachment-0001.html From thomas.shulok at lmco.com Thu Apr 7 17:43:11 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Tue Mar 28 18:25:21 2006 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi There, I'm attempting to talk RS232 between an embedded Linux box and a Windows box. Everything connects up fine, and I can send and receive a simple sequence of bytes with no problems. However, if around 5 seconds goes by without me sending something, I get the following when I attempt to send. java.io.IOException: Input/output error in writeArray Stack trace: java/lang/Throwable.()V java/lang/Throwable.(Ljava/lang/String;)V java/io/IOException.(Ljava/lang/String;)V gnu/io/RXTXPort.writeArray([BIIZ)V gnu/io/RXTXPort$SerialOutputStream.write([B)V SerialTest.main([Ljava/lang/String;)V If there interval is shorter (say 2 seconds between sends), I have no problems. On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and librxtxSerial-2.0.7pre2.so. Any ideas? Thanks, Thom -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5b23dcf/attachment-0001.html From taj at www.linux.org.uk Thu Apr 7 19:22:36 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue Mar 28 18:25:21 2006 Subject: [Rxtx] Input/output error in writeArray In-Reply-To: References: Message-ID: On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a Windows > box. Everything connects up fine, and I can send and receive a simple > sequence of bytes with no problems. However, if around 5 seconds goes > by without me sending something, I get the following when I attempt to > send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj@www.linux.org.uk From taj at www.linux.org.uk Thu Apr 7 19:24:59 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue Mar 28 18:25:21 2006 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) Message-ID: hmm. This would not work from applets would it? -- Trent Jarvi taj@www.linux.org.uk ---------- Forwarded message ---------- Date: Thu, 07 Apr 2005 16:05:53 -0400 From: Chris Gaffney To: taj@www.linux.org.uk Subject: RXTX Libraries on Classpath fix Hi, I submitted a patch for RXTX a few weeks ago to allow for loading the native libraries from the classpath. Since sending it to you I found it wasn't working on windows. I've fixed the problem and created a new patch that should replace the older one. The actual change is a one line from a String.equals() to a String.startsWith(). Thanks for a great piece of software, -Chris Gaffney Grand Valley State University -------------- next part -------------- A non-text attachment was scrubbed... Name: libraries_on_classpath_fixed.patch Type: text/x-patch Size: 5617 bytes Desc: Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5d423b8/libraries_on_classpath_fixed-0001.bin From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Tue Mar 28 18:25:21 2006 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj@www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj@www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx@mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Tue Mar 28 18:25:21 2006 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj@www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj@www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx@mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From thomas.shulok at lmco.com Fri Apr 8 10:38:55 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Tue Mar 28 18:25:21 2006 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi Trent, Thanks for the prompt response. Before diving deeper, I was wondering if there is a timeout parameter somewhere in the stack that I have not set properly. Given the nature of the failure (only fails if the line has been idle for a few seconds), it feels like some kind of timeout issue... Thanks again, Thom -----Original Message----- From: rxtx-bounces@mail.linuxgrrls.org [mailto:rxtx-bounces@mail.linuxgrrls.org] On Behalf Of Trent Jarvi Sent: Thursday, April 07, 2005 6:23 PM To: Java RXTX discussion Subject: Re: [Rxtx] Input/output error in writeArray On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a > Windows box. Everything connects up fine, and I can send and receive > a simple sequence of bytes with no problems. However, if around 5 > seconds goes by without me sending something, I get the following when > I attempt to send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj@www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx@mail.linuxgrrls.org http://mail.linuxgrrls.org/mailman/listinfo/rxtx From ricardo.trindade at emation.pt Mon Apr 4 09:17:23 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue Mar 28 20:17:17 2006 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot Message-ID: <42515A83.4050907@emation.pt> Hi, I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most recent stable snapshot), and get the following exception : It looks like rxtx has been compiled with jdk 1.5. If this was indeed the case, I think there is a compilation flag that generates code that runs on older jdks. java.lang.UnsupportedClassVersionError: gnu/io/UnsupportedCommOperationException (Unsupported major.minor version 49.0) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at java.net.URLClassLoader.defineClass(URLClassLoader.java:251) at java.net.URLClassLoader.access$100(URLClassLoader.java:55) at java.net.URLClassLoader$1.run(URLClassLoader.java:194) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:187) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:141) I'm trying to run it with 1.4. thanks Ricardo From taj at www.linux.org.uk Tue Apr 5 00:48:12 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue Mar 28 20:17:17 2006 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42515A83.4050907@emation.pt> References: <42515A83.4050907@emation.pt> Message-ID: On Mon, 4 Apr 2005, Ricardo Trindade wrote: > Hi, > > I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most > recent stable snapshot), and get the following exception : > > It looks like rxtx has been compiled with jdk 1.5. If this was > indeed the case, I think there is a compilation flag that generates code > that runs on older jdks. > > java.lang.UnsupportedClassVersionError: > gnu/io/UnsupportedCommOperationException (Unsupported major.minor > version 49.0) [snip] Thanks Ricardo I recompiled the jar with javac -source 1.3 -target 1.3. That should cover most of the JRE's in use today. I also compiled the rxtx 2.0 x86_64 native library which appeared to be missing. I tried looking for flags to pass gcc 4.0 to make the native libraries more backwards compatible but only found options for C++ which is not used in rxtx. I've got a list of other bugs that I'll be going through in the next few weeks but for now I just left them with the same CVS filename - no code changes. ftp://ftp.qbang.org/pub/rxtx/rxtx-2.0-CVS-20050120-bins.tar.gz ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-CVS-20050120-bins.tar.gz -- Trent Jarvi taj@www.linux.org.uk From ricardo.trindade at emation.pt Tue Apr 5 02:24:33 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue Mar 28 20:17:17 2006 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: References: <42515A83.4050907@emation.pt> Message-ID: <42524B41.3040300@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050405/5919abbb/attachment-0002.html From taj at www.linux.org.uk Tue Apr 5 03:00:29 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue Mar 28 20:17:17 2006 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42524B41.3040300@emation.pt> References: <42515A83.4050907@emation.pt> <42524B41.3040300@emation.pt> Message-ID: On Tue, 5 Apr 2005, Ricardo Trindade wrote: > Will you anounce to the list when a new release is available ? > There will be several incremental releases announced here. Once those are done, we will release 2.1.7 and 2.0.7. -- Trent Jarvi taj@www.linux.org.uk From no_spam at somewhere.com Tue Apr 5 11:55:37 2005 From: no_spam at somewhere.com (no_spam@somewhere.com) Date: Tue Mar 28 20:17:17 2006 Subject: [Rxtx] Closing a port from an event listener results in a deadlock Message-ID: <20050405175537.GA21747@rcog.homelinux.net> On the message I sent on March 14, does anyone had the chance to try the modification? Or was it already fixed? (I haven't searched the archive extensively) Or maybe my message got catched by some spam filters? (it made it to the list archive though) Anyway, I would appreciate some feedback (through the list) Thanks From taj at www.linux.org.uk Tue Apr 5 14:42:28 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue Mar 28 20:17:17 2006 Subject: [Rxtx] Closing a port from an event listener results in a deadlock In-Reply-To: <20050405175537.GA21747@rcog.homelinux.net> References: <20050405175537.GA21747@rcog.homelinux.net> Message-ID: On Tue, 5 Apr 2005 no_spam@somewhere.com wrote: > On the message I sent on March 14, does anyone had the chance to try the > modification? > > Or was it already fixed? (I haven't searched the archive extensively) > > Or maybe my message got catched by some spam filters? (it made it to the list > archive though) > > Anyway, I would appreciate some feedback (through the list) > The patch is here http://marc.theaimsgroup.com/?l=rxtx&m=111084488820288&w=2 I have applied this patch to a local copy but will not be doing formal testing for a couple weeks. I do not try to close ports from inside the eventListenter usually so I encourage any feedback also. If there are no problems reported, I expect this will go into rxtx 2.1-7. -- Trent Jarvi taj@www.linux.org.uk From ricardo.trindade at emation.pt Wed Apr 6 08:33:42 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue Mar 28 20:17:17 2006 Subject: [Rxtx] getting RXTX version Message-ID: <4253F346.50102@emation.pt> Hi, I want to make sure my deployments have the same version of RXTX jar and native lib. I know the version of the jar can be obtained in the Version class, but how can I obtain the native version ? I know RXTX prints to the console a warning if the version is different. Is there a way to programatically know is this is the case ? I would like to log that to our app's log thanks Ricardo From taj at www.linux.org.uk Wed Apr 6 15:10:20 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue Mar 28 20:17:17 2006 Subject: [Rxtx] getting RXTX version In-Reply-To: <4253F346.50102@emation.pt> References: <4253F346.50102@emation.pt> Message-ID: On Wed, 6 Apr 2005, Ricardo Trindade wrote: > Hi, > > I want to make sure my deployments have the same version of RXTX jar > and native lib. > > I know the version of the jar can be obtained in the Version class, > but how can I obtain the native version ? > > I know RXTX prints to the console a warning if the version is > different. Is there a way to programatically know is this is the case ? > > I would like to log that to our app's log > There isn't a suggested way of doing that right now. We could move things around and have a static String RXTXVersion.getNativeVersion() in future releases. Is this what you expected? This is not documented in commapi at all. I just tossed that in to catch conflicts while developing. It would be nice to have access in GUI applications though. It may be possible to access RXTXCommDriver.LibVersion right now. -- Trent Jarvi taj@www.linux.org.uk From ricardo.trindade at emation.pt Thu Apr 7 02:51:00 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue Mar 28 20:17:17 2006 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> Message-ID: <4254F474.7020905@emation.pt> >There isn't a suggested way of doing that right now. We could move things >around and have a static String RXTXVersion.getNativeVersion() in future >releases. Is this what you expected? > > Yes, that would be perfect. >This is not documented in commapi at all. I just tossed that in to catch >conflicts while developing. It would be nice to have access in GUI >applications though. > >It may be possible to access RXTXCommDriver.LibVersion right now. > > > I tried, and I don't think it's possible. From taj at www.linux.org.uk Thu Apr 7 03:32:04 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue Mar 28 20:17:17 2006 Subject: [Rxtx] getting RXTX version In-Reply-To: <4254F474.7020905@emation.pt> References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: On Thu, 7 Apr 2005, Ricardo Trindade wrote: > > >There isn't a suggested way of doing that right now. We could move things > >around and have a static String RXTXVersion.getNativeVersion() in future > >releases. Is this what you expected? > > > > > > Yes, that would be perfect. > The attached should do what you want. You will still need to catch an exception for older versions... -- Trent Jarvi taj@www.linux.org.uk -------------- next part -------------- ? public_version.patch Index: RXTXCommDriver.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXCommDriver.java,v retrieving revision 1.16.2.51 diff -u -r1.16.2.51 RXTXCommDriver.java --- RXTXCommDriver.java 12 Oct 2004 09:13:30 -0000 1.16.2.51 +++ RXTXCommDriver.java 7 Apr 2005 09:29:04 -0000 @@ -54,7 +54,7 @@ the Library. */ String JarVersion = RXTXVersion.getVersion(); - String LibVersion = nativeGetVersion(); + String LibVersion = RXTXVersion.nativeGetVersion(); if ( devel ) { System.out.println("Devel Library"); @@ -76,7 +76,6 @@ /** Get the Serial port prefixes for the running OS */ private String deviceDirectory; private String osName; - private static native String nativeGetVersion(); private native boolean registerKnownPorts(int PortType); private native boolean isPortPrefixValid(String dev); private native boolean testRead(String dev, int type); Index: RXTXVersion.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXVersion.java,v retrieving revision 1.2.2.31 diff -u -r1.2.2.31 RXTXVersion.java --- RXTXVersion.java 16 Oct 2004 16:20:35 -0000 1.2.2.31 +++ RXTXVersion.java 7 Apr 2005 09:29:04 -0000 @@ -36,6 +36,7 @@ private static String Version; static { + System.loadLibrary( "rxtxSerial" ); Version = "RXTX-2.1-7pre20"; } /** @@ -47,4 +48,5 @@ { return(Version); } + public static native String nativeGetVersion(); } Index: SerialImp.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v retrieving revision 1.46.2.181 diff -u -r1.46.2.181 SerialImp.c --- SerialImp.c 17 Oct 2004 09:48:56 -0000 1.46.2.181 +++ SerialImp.c 7 Apr 2005 09:29:07 -0000 @@ -116,6 +116,7 @@ * It will eventually be removed. * */ #define RXTXPort(foo) Java_gnu_io_RXTXPort_ ## foo +#define RXTXVersion(foo) Java_gnu_io_RXTXVersion_ ## foo #define RXTXCommDriver(foo) Java_gnu_io_RXTXCommDriver_ ## foo #if defined(__sun__) || defined(__hpux__) @@ -4001,7 +4002,7 @@ } /*---------------------------------------------------------- -RXTXCommDriver.nativeGetVersion +RXTXVersion.nativeGetVersion accept: none perform: return the current version @@ -4010,9 +4011,10 @@ comments: This is used to avoid mixing versions of the .jar and native library. First introduced in rxtx-1.5-9 + Moved from RXTXCommDriver to RXTXVersion in rxtx-2.1-7 ----------------------------------------------------------*/ -JNIEXPORT jstring JNICALL RXTXCommDriver(nativeGetVersion) (JNIEnv *env, +JNIEXPORT jstring JNICALL RXTXVersion(nativeGetVersion) (JNIEnv *env, jclass jclazz ) { return (*env)->NewStringUTF( env, "RXTX-2.1-7pre20" ); From ricardo.trindade at emation.pt Thu Apr 7 03:45:58 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue Mar 28 20:17:17 2006 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: <42550156.2040908@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050407/05212451/attachment-0002.html From thomas.shulok at lmco.com Thu Apr 7 17:43:11 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Tue Mar 28 20:17:17 2006 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi There, I'm attempting to talk RS232 between an embedded Linux box and a Windows box. Everything connects up fine, and I can send and receive a simple sequence of bytes with no problems. However, if around 5 seconds goes by without me sending something, I get the following when I attempt to send. java.io.IOException: Input/output error in writeArray Stack trace: java/lang/Throwable.()V java/lang/Throwable.(Ljava/lang/String;)V java/io/IOException.(Ljava/lang/String;)V gnu/io/RXTXPort.writeArray([BIIZ)V gnu/io/RXTXPort$SerialOutputStream.write([B)V SerialTest.main([Ljava/lang/String;)V If there interval is shorter (say 2 seconds between sends), I have no problems. On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and librxtxSerial-2.0.7pre2.so. Any ideas? Thanks, Thom -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5b23dcf/attachment-0002.html From taj at www.linux.org.uk Thu Apr 7 19:22:36 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue Mar 28 20:17:17 2006 Subject: [Rxtx] Input/output error in writeArray In-Reply-To: References: Message-ID: On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a Windows > box. Everything connects up fine, and I can send and receive a simple > sequence of bytes with no problems. However, if around 5 seconds goes > by without me sending something, I get the following when I attempt to > send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj@www.linux.org.uk From taj at www.linux.org.uk Thu Apr 7 19:24:59 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue Mar 28 20:17:17 2006 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) Message-ID: hmm. This would not work from applets would it? -- Trent Jarvi taj@www.linux.org.uk ---------- Forwarded message ---------- Date: Thu, 07 Apr 2005 16:05:53 -0400 From: Chris Gaffney To: taj@www.linux.org.uk Subject: RXTX Libraries on Classpath fix Hi, I submitted a patch for RXTX a few weeks ago to allow for loading the native libraries from the classpath. Since sending it to you I found it wasn't working on windows. I've fixed the problem and created a new patch that should replace the older one. The actual change is a one line from a String.equals() to a String.startsWith(). Thanks for a great piece of software, -Chris Gaffney Grand Valley State University -------------- next part -------------- A non-text attachment was scrubbed... Name: libraries_on_classpath_fixed.patch Type: text/x-patch Size: 5617 bytes Desc: Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5d423b8/libraries_on_classpath_fixed-0002.bin From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Tue Mar 28 20:17:17 2006 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj@www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj@www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx@mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Tue Mar 28 20:17:17 2006 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj@www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj@www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx@mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From thomas.shulok at lmco.com Fri Apr 8 10:38:55 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Tue Mar 28 20:17:18 2006 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi Trent, Thanks for the prompt response. Before diving deeper, I was wondering if there is a timeout parameter somewhere in the stack that I have not set properly. Given the nature of the failure (only fails if the line has been idle for a few seconds), it feels like some kind of timeout issue... Thanks again, Thom -----Original Message----- From: rxtx-bounces@mail.linuxgrrls.org [mailto:rxtx-bounces@mail.linuxgrrls.org] On Behalf Of Trent Jarvi Sent: Thursday, April 07, 2005 6:23 PM To: Java RXTX discussion Subject: Re: [Rxtx] Input/output error in writeArray On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a > Windows box. Everything connects up fine, and I can send and receive > a simple sequence of bytes with no problems. However, if around 5 > seconds goes by without me sending something, I get the following when > I attempt to send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj@www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx@mail.linuxgrrls.org http://mail.linuxgrrls.org/mailman/listinfo/rxtx From ricardo.trindade at emation.pt Mon Apr 4 09:17:23 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Mon, 04 Apr 2005 16:17:23 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot Message-ID: <42515A83.4050907@emation.pt> Hi, I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most recent stable snapshot), and get the following exception : It looks like rxtx has been compiled with jdk 1.5. If this was indeed the case, I think there is a compilation flag that generates code that runs on older jdks. java.lang.UnsupportedClassVersionError: gnu/io/UnsupportedCommOperationException (Unsupported major.minor version 49.0) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at java.net.URLClassLoader.defineClass(URLClassLoader.java:251) at java.net.URLClassLoader.access$100(URLClassLoader.java:55) at java.net.URLClassLoader$1.run(URLClassLoader.java:194) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:187) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:141) I'm trying to run it with 1.4. thanks Ricardo From taj at www.linux.org.uk Tue Apr 5 00:48:12 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 07:48:12 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42515A83.4050907@emation.pt> References: <42515A83.4050907@emation.pt> Message-ID: On Mon, 4 Apr 2005, Ricardo Trindade wrote: > Hi, > > I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most > recent stable snapshot), and get the following exception : > > It looks like rxtx has been compiled with jdk 1.5. If this was > indeed the case, I think there is a compilation flag that generates code > that runs on older jdks. > > java.lang.UnsupportedClassVersionError: > gnu/io/UnsupportedCommOperationException (Unsupported major.minor > version 49.0) [snip] Thanks Ricardo I recompiled the jar with javac -source 1.3 -target 1.3. That should cover most of the JRE's in use today. I also compiled the rxtx 2.0 x86_64 native library which appeared to be missing. I tried looking for flags to pass gcc 4.0 to make the native libraries more backwards compatible but only found options for C++ which is not used in rxtx. I've got a list of other bugs that I'll be going through in the next few weeks but for now I just left them with the same CVS filename - no code changes. ftp://ftp.qbang.org/pub/rxtx/rxtx-2.0-CVS-20050120-bins.tar.gz ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-CVS-20050120-bins.tar.gz -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Tue Apr 5 02:24:33 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 05 Apr 2005 09:24:33 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: References: <42515A83.4050907@emation.pt> Message-ID: <42524B41.3040300@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050405/5919abbb/attachment-0003.html From taj at www.linux.org.uk Tue Apr 5 03:00:29 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 10:00:29 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42524B41.3040300@emation.pt> References: <42515A83.4050907@emation.pt> <42524B41.3040300@emation.pt> Message-ID: On Tue, 5 Apr 2005, Ricardo Trindade wrote: > Will you anounce to the list when a new release is available ? > There will be several incremental releases announced here. Once those are done, we will release 2.1.7 and 2.0.7. -- Trent Jarvi taj at www.linux.org.uk From no_spam at somewhere.com Tue Apr 5 11:55:37 2005 From: no_spam at somewhere.com (no_spam@somewhere.com) Date: Tue, 5 Apr 2005 13:55:37 -0400 Subject: [Rxtx] Closing a port from an event listener results in a deadlock Message-ID: <20050405175537.GA21747@rcog.homelinux.net> On the message I sent on March 14, does anyone had the chance to try the modification? Or was it already fixed? (I haven't searched the archive extensively) Or maybe my message got catched by some spam filters? (it made it to the list archive though) Anyway, I would appreciate some feedback (through the list) Thanks From taj at www.linux.org.uk Tue Apr 5 14:42:28 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 21:42:28 +0100 (BST) Subject: [Rxtx] Closing a port from an event listener results in a deadlock In-Reply-To: <20050405175537.GA21747@rcog.homelinux.net> References: <20050405175537.GA21747@rcog.homelinux.net> Message-ID: On Tue, 5 Apr 2005 no_spam at somewhere.com wrote: > On the message I sent on March 14, does anyone had the chance to try the > modification? > > Or was it already fixed? (I haven't searched the archive extensively) > > Or maybe my message got catched by some spam filters? (it made it to the list > archive though) > > Anyway, I would appreciate some feedback (through the list) > The patch is here http://marc.theaimsgroup.com/?l=rxtx&m=111084488820288&w=2 I have applied this patch to a local copy but will not be doing formal testing for a couple weeks. I do not try to close ports from inside the eventListenter usually so I encourage any feedback also. If there are no problems reported, I expect this will go into rxtx 2.1-7. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Wed Apr 6 08:33:42 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Wed, 06 Apr 2005 15:33:42 +0100 Subject: [Rxtx] getting RXTX version Message-ID: <4253F346.50102@emation.pt> Hi, I want to make sure my deployments have the same version of RXTX jar and native lib. I know the version of the jar can be obtained in the Version class, but how can I obtain the native version ? I know RXTX prints to the console a warning if the version is different. Is there a way to programatically know is this is the case ? I would like to log that to our app's log thanks Ricardo From taj at www.linux.org.uk Wed Apr 6 15:10:20 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 6 Apr 2005 22:10:20 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4253F346.50102@emation.pt> References: <4253F346.50102@emation.pt> Message-ID: On Wed, 6 Apr 2005, Ricardo Trindade wrote: > Hi, > > I want to make sure my deployments have the same version of RXTX jar > and native lib. > > I know the version of the jar can be obtained in the Version class, > but how can I obtain the native version ? > > I know RXTX prints to the console a warning if the version is > different. Is there a way to programatically know is this is the case ? > > I would like to log that to our app's log > There isn't a suggested way of doing that right now. We could move things around and have a static String RXTXVersion.getNativeVersion() in future releases. Is this what you expected? This is not documented in commapi at all. I just tossed that in to catch conflicts while developing. It would be nice to have access in GUI applications though. It may be possible to access RXTXCommDriver.LibVersion right now. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Thu Apr 7 02:51:00 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 09:51:00 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> Message-ID: <4254F474.7020905@emation.pt> >There isn't a suggested way of doing that right now. We could move things >around and have a static String RXTXVersion.getNativeVersion() in future >releases. Is this what you expected? > > Yes, that would be perfect. >This is not documented in commapi at all. I just tossed that in to catch >conflicts while developing. It would be nice to have access in GUI >applications though. > >It may be possible to access RXTXCommDriver.LibVersion right now. > > > I tried, and I don't think it's possible. From taj at www.linux.org.uk Thu Apr 7 03:32:04 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 7 Apr 2005 10:32:04 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4254F474.7020905@emation.pt> References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: On Thu, 7 Apr 2005, Ricardo Trindade wrote: > > >There isn't a suggested way of doing that right now. We could move things > >around and have a static String RXTXVersion.getNativeVersion() in future > >releases. Is this what you expected? > > > > > > Yes, that would be perfect. > The attached should do what you want. You will still need to catch an exception for older versions... -- Trent Jarvi taj at www.linux.org.uk -------------- next part -------------- ? public_version.patch Index: RXTXCommDriver.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXCommDriver.java,v retrieving revision 1.16.2.51 diff -u -r1.16.2.51 RXTXCommDriver.java --- RXTXCommDriver.java 12 Oct 2004 09:13:30 -0000 1.16.2.51 +++ RXTXCommDriver.java 7 Apr 2005 09:29:04 -0000 @@ -54,7 +54,7 @@ the Library. */ String JarVersion = RXTXVersion.getVersion(); - String LibVersion = nativeGetVersion(); + String LibVersion = RXTXVersion.nativeGetVersion(); if ( devel ) { System.out.println("Devel Library"); @@ -76,7 +76,6 @@ /** Get the Serial port prefixes for the running OS */ private String deviceDirectory; private String osName; - private static native String nativeGetVersion(); private native boolean registerKnownPorts(int PortType); private native boolean isPortPrefixValid(String dev); private native boolean testRead(String dev, int type); Index: RXTXVersion.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXVersion.java,v retrieving revision 1.2.2.31 diff -u -r1.2.2.31 RXTXVersion.java --- RXTXVersion.java 16 Oct 2004 16:20:35 -0000 1.2.2.31 +++ RXTXVersion.java 7 Apr 2005 09:29:04 -0000 @@ -36,6 +36,7 @@ private static String Version; static { + System.loadLibrary( "rxtxSerial" ); Version = "RXTX-2.1-7pre20"; } /** @@ -47,4 +48,5 @@ { return(Version); } + public static native String nativeGetVersion(); } Index: SerialImp.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v retrieving revision 1.46.2.181 diff -u -r1.46.2.181 SerialImp.c --- SerialImp.c 17 Oct 2004 09:48:56 -0000 1.46.2.181 +++ SerialImp.c 7 Apr 2005 09:29:07 -0000 @@ -116,6 +116,7 @@ * It will eventually be removed. * */ #define RXTXPort(foo) Java_gnu_io_RXTXPort_ ## foo +#define RXTXVersion(foo) Java_gnu_io_RXTXVersion_ ## foo #define RXTXCommDriver(foo) Java_gnu_io_RXTXCommDriver_ ## foo #if defined(__sun__) || defined(__hpux__) @@ -4001,7 +4002,7 @@ } /*---------------------------------------------------------- -RXTXCommDriver.nativeGetVersion +RXTXVersion.nativeGetVersion accept: none perform: return the current version @@ -4010,9 +4011,10 @@ comments: This is used to avoid mixing versions of the .jar and native library. First introduced in rxtx-1.5-9 + Moved from RXTXCommDriver to RXTXVersion in rxtx-2.1-7 ----------------------------------------------------------*/ -JNIEXPORT jstring JNICALL RXTXCommDriver(nativeGetVersion) (JNIEnv *env, +JNIEXPORT jstring JNICALL RXTXVersion(nativeGetVersion) (JNIEnv *env, jclass jclazz ) { return (*env)->NewStringUTF( env, "RXTX-2.1-7pre20" ); From ricardo.trindade at emation.pt Thu Apr 7 03:45:58 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 10:45:58 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: <42550156.2040908@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050407/05212451/attachment-0003.html From thomas.shulok at lmco.com Thu Apr 7 17:43:11 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Thu, 07 Apr 2005 19:43:11 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi There, I'm attempting to talk RS232 between an embedded Linux box and a Windows box. Everything connects up fine, and I can send and receive a simple sequence of bytes with no problems. However, if around 5 seconds goes by without me sending something, I get the following when I attempt to send. java.io.IOException: Input/output error in writeArray Stack trace: java/lang/Throwable.()V java/lang/Throwable.(Ljava/lang/String;)V java/io/IOException.(Ljava/lang/String;)V gnu/io/RXTXPort.writeArray([BIIZ)V gnu/io/RXTXPort$SerialOutputStream.write([B)V SerialTest.main([Ljava/lang/String;)V If there interval is shorter (say 2 seconds between sends), I have no problems. On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and librxtxSerial-2.0.7pre2.so. Any ideas? Thanks, Thom -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5b23dcf/attachment-0003.html From taj at www.linux.org.uk Thu Apr 7 19:22:36 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:22:36 +0100 (BST) Subject: [Rxtx] Input/output error in writeArray In-Reply-To: References: Message-ID: On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a Windows > box. Everything connects up fine, and I can send and receive a simple > sequence of bytes with no problems. However, if around 5 seconds goes > by without me sending something, I get the following when I attempt to > send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Apr 7 19:24:59 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:24:59 +0100 (BST) Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) Message-ID: hmm. This would not work from applets would it? -- Trent Jarvi taj at www.linux.org.uk ---------- Forwarded message ---------- Date: Thu, 07 Apr 2005 16:05:53 -0400 From: Chris Gaffney To: taj at www.linux.org.uk Subject: RXTX Libraries on Classpath fix Hi, I submitted a patch for RXTX a few weeks ago to allow for loading the native libraries from the classpath. Since sending it to you I found it wasn't working on windows. I've fixed the problem and created a new patch that should replace the older one. The actual change is a one line from a String.equals() to a String.startsWith(). Thanks for a great piece of software, -Chris Gaffney Grand Valley State University -------------- next part -------------- A non-text attachment was scrubbed... Name: libraries_on_classpath_fixed.patch Type: text/x-patch Size: 5617 bytes Desc: Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5d423b8/libraries_on_classpath_fixed-0003.bin From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From thomas.shulok at lmco.com Fri Apr 8 10:38:55 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Fri, 08 Apr 2005 12:38:55 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi Trent, Thanks for the prompt response. Before diving deeper, I was wondering if there is a timeout parameter somewhere in the stack that I have not set properly. Given the nature of the failure (only fails if the line has been idle for a few seconds), it feels like some kind of timeout issue... Thanks again, Thom -----Original Message----- From: rxtx-bounces at mail.linuxgrrls.org [mailto:rxtx-bounces at mail.linuxgrrls.org] On Behalf Of Trent Jarvi Sent: Thursday, April 07, 2005 6:23 PM To: Java RXTX discussion Subject: Re: [Rxtx] Input/output error in writeArray On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a > Windows box. Everything connects up fine, and I can send and receive > a simple sequence of bytes with no problems. However, if around 5 > seconds goes by without me sending something, I get the following when > I attempt to send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at mail.linuxgrrls.org http://mail.linuxgrrls.org/mailman/listinfo/rxtx From ricardo.trindade at emation.pt Mon Apr 4 09:17:23 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Mon, 04 Apr 2005 16:17:23 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot Message-ID: <42515A83.4050907@emation.pt> Hi, I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most recent stable snapshot), and get the following exception : It looks like rxtx has been compiled with jdk 1.5. If this was indeed the case, I think there is a compilation flag that generates code that runs on older jdks. java.lang.UnsupportedClassVersionError: gnu/io/UnsupportedCommOperationException (Unsupported major.minor version 49.0) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at java.net.URLClassLoader.defineClass(URLClassLoader.java:251) at java.net.URLClassLoader.access$100(URLClassLoader.java:55) at java.net.URLClassLoader$1.run(URLClassLoader.java:194) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:187) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:141) I'm trying to run it with 1.4. thanks Ricardo From taj at www.linux.org.uk Tue Apr 5 00:48:12 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 07:48:12 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42515A83.4050907@emation.pt> References: <42515A83.4050907@emation.pt> Message-ID: On Mon, 4 Apr 2005, Ricardo Trindade wrote: > Hi, > > I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most > recent stable snapshot), and get the following exception : > > It looks like rxtx has been compiled with jdk 1.5. If this was > indeed the case, I think there is a compilation flag that generates code > that runs on older jdks. > > java.lang.UnsupportedClassVersionError: > gnu/io/UnsupportedCommOperationException (Unsupported major.minor > version 49.0) [snip] Thanks Ricardo I recompiled the jar with javac -source 1.3 -target 1.3. That should cover most of the JRE's in use today. I also compiled the rxtx 2.0 x86_64 native library which appeared to be missing. I tried looking for flags to pass gcc 4.0 to make the native libraries more backwards compatible but only found options for C++ which is not used in rxtx. I've got a list of other bugs that I'll be going through in the next few weeks but for now I just left them with the same CVS filename - no code changes. ftp://ftp.qbang.org/pub/rxtx/rxtx-2.0-CVS-20050120-bins.tar.gz ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-CVS-20050120-bins.tar.gz -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Tue Apr 5 02:24:33 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 05 Apr 2005 09:24:33 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: References: <42515A83.4050907@emation.pt> Message-ID: <42524B41.3040300@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050405/5919abbb/attachment-0004.html From taj at www.linux.org.uk Tue Apr 5 03:00:29 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 10:00:29 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42524B41.3040300@emation.pt> References: <42515A83.4050907@emation.pt> <42524B41.3040300@emation.pt> Message-ID: On Tue, 5 Apr 2005, Ricardo Trindade wrote: > Will you anounce to the list when a new release is available ? > There will be several incremental releases announced here. Once those are done, we will release 2.1.7 and 2.0.7. -- Trent Jarvi taj at www.linux.org.uk From no_spam at somewhere.com Tue Apr 5 11:55:37 2005 From: no_spam at somewhere.com (no_spam@somewhere.com) Date: Tue, 5 Apr 2005 13:55:37 -0400 Subject: [Rxtx] Closing a port from an event listener results in a deadlock Message-ID: <20050405175537.GA21747@rcog.homelinux.net> On the message I sent on March 14, does anyone had the chance to try the modification? Or was it already fixed? (I haven't searched the archive extensively) Or maybe my message got catched by some spam filters? (it made it to the list archive though) Anyway, I would appreciate some feedback (through the list) Thanks From taj at www.linux.org.uk Tue Apr 5 14:42:28 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 21:42:28 +0100 (BST) Subject: [Rxtx] Closing a port from an event listener results in a deadlock In-Reply-To: <20050405175537.GA21747@rcog.homelinux.net> References: <20050405175537.GA21747@rcog.homelinux.net> Message-ID: On Tue, 5 Apr 2005 no_spam at somewhere.com wrote: > On the message I sent on March 14, does anyone had the chance to try the > modification? > > Or was it already fixed? (I haven't searched the archive extensively) > > Or maybe my message got catched by some spam filters? (it made it to the list > archive though) > > Anyway, I would appreciate some feedback (through the list) > The patch is here http://marc.theaimsgroup.com/?l=rxtx&m=111084488820288&w=2 I have applied this patch to a local copy but will not be doing formal testing for a couple weeks. I do not try to close ports from inside the eventListenter usually so I encourage any feedback also. If there are no problems reported, I expect this will go into rxtx 2.1-7. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Wed Apr 6 08:33:42 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Wed, 06 Apr 2005 15:33:42 +0100 Subject: [Rxtx] getting RXTX version Message-ID: <4253F346.50102@emation.pt> Hi, I want to make sure my deployments have the same version of RXTX jar and native lib. I know the version of the jar can be obtained in the Version class, but how can I obtain the native version ? I know RXTX prints to the console a warning if the version is different. Is there a way to programatically know is this is the case ? I would like to log that to our app's log thanks Ricardo From taj at www.linux.org.uk Wed Apr 6 15:10:20 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 6 Apr 2005 22:10:20 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4253F346.50102@emation.pt> References: <4253F346.50102@emation.pt> Message-ID: On Wed, 6 Apr 2005, Ricardo Trindade wrote: > Hi, > > I want to make sure my deployments have the same version of RXTX jar > and native lib. > > I know the version of the jar can be obtained in the Version class, > but how can I obtain the native version ? > > I know RXTX prints to the console a warning if the version is > different. Is there a way to programatically know is this is the case ? > > I would like to log that to our app's log > There isn't a suggested way of doing that right now. We could move things around and have a static String RXTXVersion.getNativeVersion() in future releases. Is this what you expected? This is not documented in commapi at all. I just tossed that in to catch conflicts while developing. It would be nice to have access in GUI applications though. It may be possible to access RXTXCommDriver.LibVersion right now. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Thu Apr 7 02:51:00 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 09:51:00 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> Message-ID: <4254F474.7020905@emation.pt> >There isn't a suggested way of doing that right now. We could move things >around and have a static String RXTXVersion.getNativeVersion() in future >releases. Is this what you expected? > > Yes, that would be perfect. >This is not documented in commapi at all. I just tossed that in to catch >conflicts while developing. It would be nice to have access in GUI >applications though. > >It may be possible to access RXTXCommDriver.LibVersion right now. > > > I tried, and I don't think it's possible. From taj at www.linux.org.uk Thu Apr 7 03:32:04 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 7 Apr 2005 10:32:04 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4254F474.7020905@emation.pt> References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: On Thu, 7 Apr 2005, Ricardo Trindade wrote: > > >There isn't a suggested way of doing that right now. We could move things > >around and have a static String RXTXVersion.getNativeVersion() in future > >releases. Is this what you expected? > > > > > > Yes, that would be perfect. > The attached should do what you want. You will still need to catch an exception for older versions... -- Trent Jarvi taj at www.linux.org.uk -------------- next part -------------- ? public_version.patch Index: RXTXCommDriver.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXCommDriver.java,v retrieving revision 1.16.2.51 diff -u -r1.16.2.51 RXTXCommDriver.java --- RXTXCommDriver.java 12 Oct 2004 09:13:30 -0000 1.16.2.51 +++ RXTXCommDriver.java 7 Apr 2005 09:29:04 -0000 @@ -54,7 +54,7 @@ the Library. */ String JarVersion = RXTXVersion.getVersion(); - String LibVersion = nativeGetVersion(); + String LibVersion = RXTXVersion.nativeGetVersion(); if ( devel ) { System.out.println("Devel Library"); @@ -76,7 +76,6 @@ /** Get the Serial port prefixes for the running OS */ private String deviceDirectory; private String osName; - private static native String nativeGetVersion(); private native boolean registerKnownPorts(int PortType); private native boolean isPortPrefixValid(String dev); private native boolean testRead(String dev, int type); Index: RXTXVersion.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXVersion.java,v retrieving revision 1.2.2.31 diff -u -r1.2.2.31 RXTXVersion.java --- RXTXVersion.java 16 Oct 2004 16:20:35 -0000 1.2.2.31 +++ RXTXVersion.java 7 Apr 2005 09:29:04 -0000 @@ -36,6 +36,7 @@ private static String Version; static { + System.loadLibrary( "rxtxSerial" ); Version = "RXTX-2.1-7pre20"; } /** @@ -47,4 +48,5 @@ { return(Version); } + public static native String nativeGetVersion(); } Index: SerialImp.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v retrieving revision 1.46.2.181 diff -u -r1.46.2.181 SerialImp.c --- SerialImp.c 17 Oct 2004 09:48:56 -0000 1.46.2.181 +++ SerialImp.c 7 Apr 2005 09:29:07 -0000 @@ -116,6 +116,7 @@ * It will eventually be removed. * */ #define RXTXPort(foo) Java_gnu_io_RXTXPort_ ## foo +#define RXTXVersion(foo) Java_gnu_io_RXTXVersion_ ## foo #define RXTXCommDriver(foo) Java_gnu_io_RXTXCommDriver_ ## foo #if defined(__sun__) || defined(__hpux__) @@ -4001,7 +4002,7 @@ } /*---------------------------------------------------------- -RXTXCommDriver.nativeGetVersion +RXTXVersion.nativeGetVersion accept: none perform: return the current version @@ -4010,9 +4011,10 @@ comments: This is used to avoid mixing versions of the .jar and native library. First introduced in rxtx-1.5-9 + Moved from RXTXCommDriver to RXTXVersion in rxtx-2.1-7 ----------------------------------------------------------*/ -JNIEXPORT jstring JNICALL RXTXCommDriver(nativeGetVersion) (JNIEnv *env, +JNIEXPORT jstring JNICALL RXTXVersion(nativeGetVersion) (JNIEnv *env, jclass jclazz ) { return (*env)->NewStringUTF( env, "RXTX-2.1-7pre20" ); From ricardo.trindade at emation.pt Thu Apr 7 03:45:58 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 10:45:58 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: <42550156.2040908@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050407/05212451/attachment-0004.html From thomas.shulok at lmco.com Thu Apr 7 17:43:11 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Thu, 07 Apr 2005 19:43:11 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi There, I'm attempting to talk RS232 between an embedded Linux box and a Windows box. Everything connects up fine, and I can send and receive a simple sequence of bytes with no problems. However, if around 5 seconds goes by without me sending something, I get the following when I attempt to send. java.io.IOException: Input/output error in writeArray Stack trace: java/lang/Throwable.()V java/lang/Throwable.(Ljava/lang/String;)V java/io/IOException.(Ljava/lang/String;)V gnu/io/RXTXPort.writeArray([BIIZ)V gnu/io/RXTXPort$SerialOutputStream.write([B)V SerialTest.main([Ljava/lang/String;)V If there interval is shorter (say 2 seconds between sends), I have no problems. On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and librxtxSerial-2.0.7pre2.so. Any ideas? Thanks, Thom -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5b23dcf/attachment-0004.html From taj at www.linux.org.uk Thu Apr 7 19:22:36 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:22:36 +0100 (BST) Subject: [Rxtx] Input/output error in writeArray In-Reply-To: References: Message-ID: On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a Windows > box. Everything connects up fine, and I can send and receive a simple > sequence of bytes with no problems. However, if around 5 seconds goes > by without me sending something, I get the following when I attempt to > send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Apr 7 19:24:59 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:24:59 +0100 (BST) Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) Message-ID: hmm. This would not work from applets would it? -- Trent Jarvi taj at www.linux.org.uk ---------- Forwarded message ---------- Date: Thu, 07 Apr 2005 16:05:53 -0400 From: Chris Gaffney To: taj at www.linux.org.uk Subject: RXTX Libraries on Classpath fix Hi, I submitted a patch for RXTX a few weeks ago to allow for loading the native libraries from the classpath. Since sending it to you I found it wasn't working on windows. I've fixed the problem and created a new patch that should replace the older one. The actual change is a one line from a String.equals() to a String.startsWith(). Thanks for a great piece of software, -Chris Gaffney Grand Valley State University -------------- next part -------------- A non-text attachment was scrubbed... Name: libraries_on_classpath_fixed.patch Type: text/x-patch Size: 5617 bytes Desc: Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5d423b8/libraries_on_classpath_fixed-0004.bin From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From thomas.shulok at lmco.com Fri Apr 8 10:38:55 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Fri, 08 Apr 2005 12:38:55 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi Trent, Thanks for the prompt response. Before diving deeper, I was wondering if there is a timeout parameter somewhere in the stack that I have not set properly. Given the nature of the failure (only fails if the line has been idle for a few seconds), it feels like some kind of timeout issue... Thanks again, Thom -----Original Message----- From: rxtx-bounces at mail.linuxgrrls.org [mailto:rxtx-bounces at mail.linuxgrrls.org] On Behalf Of Trent Jarvi Sent: Thursday, April 07, 2005 6:23 PM To: Java RXTX discussion Subject: Re: [Rxtx] Input/output error in writeArray On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a > Windows box. Everything connects up fine, and I can send and receive > a simple sequence of bytes with no problems. However, if around 5 > seconds goes by without me sending something, I get the following when > I attempt to send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at mail.linuxgrrls.org http://mail.linuxgrrls.org/mailman/listinfo/rxtx From ricardo.trindade at emation.pt Mon Apr 4 09:17:23 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Mon, 04 Apr 2005 16:17:23 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot Message-ID: <42515A83.4050907@emation.pt> Hi, I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most recent stable snapshot), and get the following exception : It looks like rxtx has been compiled with jdk 1.5. If this was indeed the case, I think there is a compilation flag that generates code that runs on older jdks. java.lang.UnsupportedClassVersionError: gnu/io/UnsupportedCommOperationException (Unsupported major.minor version 49.0) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at java.net.URLClassLoader.defineClass(URLClassLoader.java:251) at java.net.URLClassLoader.access$100(URLClassLoader.java:55) at java.net.URLClassLoader$1.run(URLClassLoader.java:194) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:187) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:141) I'm trying to run it with 1.4. thanks Ricardo From taj at www.linux.org.uk Tue Apr 5 00:48:12 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 07:48:12 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42515A83.4050907@emation.pt> References: <42515A83.4050907@emation.pt> Message-ID: On Mon, 4 Apr 2005, Ricardo Trindade wrote: > Hi, > > I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most > recent stable snapshot), and get the following exception : > > It looks like rxtx has been compiled with jdk 1.5. If this was > indeed the case, I think there is a compilation flag that generates code > that runs on older jdks. > > java.lang.UnsupportedClassVersionError: > gnu/io/UnsupportedCommOperationException (Unsupported major.minor > version 49.0) [snip] Thanks Ricardo I recompiled the jar with javac -source 1.3 -target 1.3. That should cover most of the JRE's in use today. I also compiled the rxtx 2.0 x86_64 native library which appeared to be missing. I tried looking for flags to pass gcc 4.0 to make the native libraries more backwards compatible but only found options for C++ which is not used in rxtx. I've got a list of other bugs that I'll be going through in the next few weeks but for now I just left them with the same CVS filename - no code changes. ftp://ftp.qbang.org/pub/rxtx/rxtx-2.0-CVS-20050120-bins.tar.gz ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-CVS-20050120-bins.tar.gz -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Tue Apr 5 02:24:33 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 05 Apr 2005 09:24:33 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: References: <42515A83.4050907@emation.pt> Message-ID: <42524B41.3040300@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050405/5919abbb/attachment-0005.html From taj at www.linux.org.uk Tue Apr 5 03:00:29 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 10:00:29 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42524B41.3040300@emation.pt> References: <42515A83.4050907@emation.pt> <42524B41.3040300@emation.pt> Message-ID: On Tue, 5 Apr 2005, Ricardo Trindade wrote: > Will you anounce to the list when a new release is available ? > There will be several incremental releases announced here. Once those are done, we will release 2.1.7 and 2.0.7. -- Trent Jarvi taj at www.linux.org.uk From no_spam at somewhere.com Tue Apr 5 11:55:37 2005 From: no_spam at somewhere.com (no_spam@somewhere.com) Date: Tue, 5 Apr 2005 13:55:37 -0400 Subject: [Rxtx] Closing a port from an event listener results in a deadlock Message-ID: <20050405175537.GA21747@rcog.homelinux.net> On the message I sent on March 14, does anyone had the chance to try the modification? Or was it already fixed? (I haven't searched the archive extensively) Or maybe my message got catched by some spam filters? (it made it to the list archive though) Anyway, I would appreciate some feedback (through the list) Thanks From taj at www.linux.org.uk Tue Apr 5 14:42:28 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 21:42:28 +0100 (BST) Subject: [Rxtx] Closing a port from an event listener results in a deadlock In-Reply-To: <20050405175537.GA21747@rcog.homelinux.net> References: <20050405175537.GA21747@rcog.homelinux.net> Message-ID: On Tue, 5 Apr 2005 no_spam at somewhere.com wrote: > On the message I sent on March 14, does anyone had the chance to try the > modification? > > Or was it already fixed? (I haven't searched the archive extensively) > > Or maybe my message got catched by some spam filters? (it made it to the list > archive though) > > Anyway, I would appreciate some feedback (through the list) > The patch is here http://marc.theaimsgroup.com/?l=rxtx&m=111084488820288&w=2 I have applied this patch to a local copy but will not be doing formal testing for a couple weeks. I do not try to close ports from inside the eventListenter usually so I encourage any feedback also. If there are no problems reported, I expect this will go into rxtx 2.1-7. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Wed Apr 6 08:33:42 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Wed, 06 Apr 2005 15:33:42 +0100 Subject: [Rxtx] getting RXTX version Message-ID: <4253F346.50102@emation.pt> Hi, I want to make sure my deployments have the same version of RXTX jar and native lib. I know the version of the jar can be obtained in the Version class, but how can I obtain the native version ? I know RXTX prints to the console a warning if the version is different. Is there a way to programatically know is this is the case ? I would like to log that to our app's log thanks Ricardo From taj at www.linux.org.uk Wed Apr 6 15:10:20 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 6 Apr 2005 22:10:20 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4253F346.50102@emation.pt> References: <4253F346.50102@emation.pt> Message-ID: On Wed, 6 Apr 2005, Ricardo Trindade wrote: > Hi, > > I want to make sure my deployments have the same version of RXTX jar > and native lib. > > I know the version of the jar can be obtained in the Version class, > but how can I obtain the native version ? > > I know RXTX prints to the console a warning if the version is > different. Is there a way to programatically know is this is the case ? > > I would like to log that to our app's log > There isn't a suggested way of doing that right now. We could move things around and have a static String RXTXVersion.getNativeVersion() in future releases. Is this what you expected? This is not documented in commapi at all. I just tossed that in to catch conflicts while developing. It would be nice to have access in GUI applications though. It may be possible to access RXTXCommDriver.LibVersion right now. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Thu Apr 7 02:51:00 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 09:51:00 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> Message-ID: <4254F474.7020905@emation.pt> >There isn't a suggested way of doing that right now. We could move things >around and have a static String RXTXVersion.getNativeVersion() in future >releases. Is this what you expected? > > Yes, that would be perfect. >This is not documented in commapi at all. I just tossed that in to catch >conflicts while developing. It would be nice to have access in GUI >applications though. > >It may be possible to access RXTXCommDriver.LibVersion right now. > > > I tried, and I don't think it's possible. From taj at www.linux.org.uk Thu Apr 7 03:32:04 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 7 Apr 2005 10:32:04 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4254F474.7020905@emation.pt> References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: On Thu, 7 Apr 2005, Ricardo Trindade wrote: > > >There isn't a suggested way of doing that right now. We could move things > >around and have a static String RXTXVersion.getNativeVersion() in future > >releases. Is this what you expected? > > > > > > Yes, that would be perfect. > The attached should do what you want. You will still need to catch an exception for older versions... -- Trent Jarvi taj at www.linux.org.uk -------------- next part -------------- ? public_version.patch Index: RXTXCommDriver.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXCommDriver.java,v retrieving revision 1.16.2.51 diff -u -r1.16.2.51 RXTXCommDriver.java --- RXTXCommDriver.java 12 Oct 2004 09:13:30 -0000 1.16.2.51 +++ RXTXCommDriver.java 7 Apr 2005 09:29:04 -0000 @@ -54,7 +54,7 @@ the Library. */ String JarVersion = RXTXVersion.getVersion(); - String LibVersion = nativeGetVersion(); + String LibVersion = RXTXVersion.nativeGetVersion(); if ( devel ) { System.out.println("Devel Library"); @@ -76,7 +76,6 @@ /** Get the Serial port prefixes for the running OS */ private String deviceDirectory; private String osName; - private static native String nativeGetVersion(); private native boolean registerKnownPorts(int PortType); private native boolean isPortPrefixValid(String dev); private native boolean testRead(String dev, int type); Index: RXTXVersion.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXVersion.java,v retrieving revision 1.2.2.31 diff -u -r1.2.2.31 RXTXVersion.java --- RXTXVersion.java 16 Oct 2004 16:20:35 -0000 1.2.2.31 +++ RXTXVersion.java 7 Apr 2005 09:29:04 -0000 @@ -36,6 +36,7 @@ private static String Version; static { + System.loadLibrary( "rxtxSerial" ); Version = "RXTX-2.1-7pre20"; } /** @@ -47,4 +48,5 @@ { return(Version); } + public static native String nativeGetVersion(); } Index: SerialImp.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v retrieving revision 1.46.2.181 diff -u -r1.46.2.181 SerialImp.c --- SerialImp.c 17 Oct 2004 09:48:56 -0000 1.46.2.181 +++ SerialImp.c 7 Apr 2005 09:29:07 -0000 @@ -116,6 +116,7 @@ * It will eventually be removed. * */ #define RXTXPort(foo) Java_gnu_io_RXTXPort_ ## foo +#define RXTXVersion(foo) Java_gnu_io_RXTXVersion_ ## foo #define RXTXCommDriver(foo) Java_gnu_io_RXTXCommDriver_ ## foo #if defined(__sun__) || defined(__hpux__) @@ -4001,7 +4002,7 @@ } /*---------------------------------------------------------- -RXTXCommDriver.nativeGetVersion +RXTXVersion.nativeGetVersion accept: none perform: return the current version @@ -4010,9 +4011,10 @@ comments: This is used to avoid mixing versions of the .jar and native library. First introduced in rxtx-1.5-9 + Moved from RXTXCommDriver to RXTXVersion in rxtx-2.1-7 ----------------------------------------------------------*/ -JNIEXPORT jstring JNICALL RXTXCommDriver(nativeGetVersion) (JNIEnv *env, +JNIEXPORT jstring JNICALL RXTXVersion(nativeGetVersion) (JNIEnv *env, jclass jclazz ) { return (*env)->NewStringUTF( env, "RXTX-2.1-7pre20" ); From ricardo.trindade at emation.pt Thu Apr 7 03:45:58 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 10:45:58 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: <42550156.2040908@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050407/05212451/attachment-0005.html From thomas.shulok at lmco.com Thu Apr 7 17:43:11 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Thu, 07 Apr 2005 19:43:11 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi There, I'm attempting to talk RS232 between an embedded Linux box and a Windows box. Everything connects up fine, and I can send and receive a simple sequence of bytes with no problems. However, if around 5 seconds goes by without me sending something, I get the following when I attempt to send. java.io.IOException: Input/output error in writeArray Stack trace: java/lang/Throwable.()V java/lang/Throwable.(Ljava/lang/String;)V java/io/IOException.(Ljava/lang/String;)V gnu/io/RXTXPort.writeArray([BIIZ)V gnu/io/RXTXPort$SerialOutputStream.write([B)V SerialTest.main([Ljava/lang/String;)V If there interval is shorter (say 2 seconds between sends), I have no problems. On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and librxtxSerial-2.0.7pre2.so. Any ideas? Thanks, Thom -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5b23dcf/attachment-0005.html From taj at www.linux.org.uk Thu Apr 7 19:22:36 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:22:36 +0100 (BST) Subject: [Rxtx] Input/output error in writeArray In-Reply-To: References: Message-ID: On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a Windows > box. Everything connects up fine, and I can send and receive a simple > sequence of bytes with no problems. However, if around 5 seconds goes > by without me sending something, I get the following when I attempt to > send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Apr 7 19:24:59 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:24:59 +0100 (BST) Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) Message-ID: hmm. This would not work from applets would it? -- Trent Jarvi taj at www.linux.org.uk ---------- Forwarded message ---------- Date: Thu, 07 Apr 2005 16:05:53 -0400 From: Chris Gaffney To: taj at www.linux.org.uk Subject: RXTX Libraries on Classpath fix Hi, I submitted a patch for RXTX a few weeks ago to allow for loading the native libraries from the classpath. Since sending it to you I found it wasn't working on windows. I've fixed the problem and created a new patch that should replace the older one. The actual change is a one line from a String.equals() to a String.startsWith(). Thanks for a great piece of software, -Chris Gaffney Grand Valley State University -------------- next part -------------- A non-text attachment was scrubbed... Name: libraries_on_classpath_fixed.patch Type: text/x-patch Size: 5617 bytes Desc: Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5d423b8/libraries_on_classpath_fixed-0005.bin From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From thomas.shulok at lmco.com Fri Apr 8 10:38:55 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Fri, 08 Apr 2005 12:38:55 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi Trent, Thanks for the prompt response. Before diving deeper, I was wondering if there is a timeout parameter somewhere in the stack that I have not set properly. Given the nature of the failure (only fails if the line has been idle for a few seconds), it feels like some kind of timeout issue... Thanks again, Thom -----Original Message----- From: rxtx-bounces at mail.linuxgrrls.org [mailto:rxtx-bounces at mail.linuxgrrls.org] On Behalf Of Trent Jarvi Sent: Thursday, April 07, 2005 6:23 PM To: Java RXTX discussion Subject: Re: [Rxtx] Input/output error in writeArray On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a > Windows box. Everything connects up fine, and I can send and receive > a simple sequence of bytes with no problems. However, if around 5 > seconds goes by without me sending something, I get the following when > I attempt to send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at mail.linuxgrrls.org http://mail.linuxgrrls.org/mailman/listinfo/rxtx From ricardo.trindade at emation.pt Mon Apr 4 09:17:23 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Mon, 04 Apr 2005 16:17:23 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot Message-ID: <42515A83.4050907@emation.pt> Hi, I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most recent stable snapshot), and get the following exception : It looks like rxtx has been compiled with jdk 1.5. If this was indeed the case, I think there is a compilation flag that generates code that runs on older jdks. java.lang.UnsupportedClassVersionError: gnu/io/UnsupportedCommOperationException (Unsupported major.minor version 49.0) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at java.net.URLClassLoader.defineClass(URLClassLoader.java:251) at java.net.URLClassLoader.access$100(URLClassLoader.java:55) at java.net.URLClassLoader$1.run(URLClassLoader.java:194) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:187) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:141) I'm trying to run it with 1.4. thanks Ricardo From taj at www.linux.org.uk Tue Apr 5 00:48:12 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 07:48:12 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42515A83.4050907@emation.pt> References: <42515A83.4050907@emation.pt> Message-ID: On Mon, 4 Apr 2005, Ricardo Trindade wrote: > Hi, > > I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most > recent stable snapshot), and get the following exception : > > It looks like rxtx has been compiled with jdk 1.5. If this was > indeed the case, I think there is a compilation flag that generates code > that runs on older jdks. > > java.lang.UnsupportedClassVersionError: > gnu/io/UnsupportedCommOperationException (Unsupported major.minor > version 49.0) [snip] Thanks Ricardo I recompiled the jar with javac -source 1.3 -target 1.3. That should cover most of the JRE's in use today. I also compiled the rxtx 2.0 x86_64 native library which appeared to be missing. I tried looking for flags to pass gcc 4.0 to make the native libraries more backwards compatible but only found options for C++ which is not used in rxtx. I've got a list of other bugs that I'll be going through in the next few weeks but for now I just left them with the same CVS filename - no code changes. ftp://ftp.qbang.org/pub/rxtx/rxtx-2.0-CVS-20050120-bins.tar.gz ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-CVS-20050120-bins.tar.gz -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Tue Apr 5 02:24:33 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 05 Apr 2005 09:24:33 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: References: <42515A83.4050907@emation.pt> Message-ID: <42524B41.3040300@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050405/5919abbb/attachment-0006.html From taj at www.linux.org.uk Tue Apr 5 03:00:29 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 10:00:29 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42524B41.3040300@emation.pt> References: <42515A83.4050907@emation.pt> <42524B41.3040300@emation.pt> Message-ID: On Tue, 5 Apr 2005, Ricardo Trindade wrote: > Will you anounce to the list when a new release is available ? > There will be several incremental releases announced here. Once those are done, we will release 2.1.7 and 2.0.7. -- Trent Jarvi taj at www.linux.org.uk From no_spam at somewhere.com Tue Apr 5 11:55:37 2005 From: no_spam at somewhere.com (no_spam@somewhere.com) Date: Tue, 5 Apr 2005 13:55:37 -0400 Subject: [Rxtx] Closing a port from an event listener results in a deadlock Message-ID: <20050405175537.GA21747@rcog.homelinux.net> On the message I sent on March 14, does anyone had the chance to try the modification? Or was it already fixed? (I haven't searched the archive extensively) Or maybe my message got catched by some spam filters? (it made it to the list archive though) Anyway, I would appreciate some feedback (through the list) Thanks From taj at www.linux.org.uk Tue Apr 5 14:42:28 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 21:42:28 +0100 (BST) Subject: [Rxtx] Closing a port from an event listener results in a deadlock In-Reply-To: <20050405175537.GA21747@rcog.homelinux.net> References: <20050405175537.GA21747@rcog.homelinux.net> Message-ID: On Tue, 5 Apr 2005 no_spam at somewhere.com wrote: > On the message I sent on March 14, does anyone had the chance to try the > modification? > > Or was it already fixed? (I haven't searched the archive extensively) > > Or maybe my message got catched by some spam filters? (it made it to the list > archive though) > > Anyway, I would appreciate some feedback (through the list) > The patch is here http://marc.theaimsgroup.com/?l=rxtx&m=111084488820288&w=2 I have applied this patch to a local copy but will not be doing formal testing for a couple weeks. I do not try to close ports from inside the eventListenter usually so I encourage any feedback also. If there are no problems reported, I expect this will go into rxtx 2.1-7. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Wed Apr 6 08:33:42 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Wed, 06 Apr 2005 15:33:42 +0100 Subject: [Rxtx] getting RXTX version Message-ID: <4253F346.50102@emation.pt> Hi, I want to make sure my deployments have the same version of RXTX jar and native lib. I know the version of the jar can be obtained in the Version class, but how can I obtain the native version ? I know RXTX prints to the console a warning if the version is different. Is there a way to programatically know is this is the case ? I would like to log that to our app's log thanks Ricardo From taj at www.linux.org.uk Wed Apr 6 15:10:20 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 6 Apr 2005 22:10:20 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4253F346.50102@emation.pt> References: <4253F346.50102@emation.pt> Message-ID: On Wed, 6 Apr 2005, Ricardo Trindade wrote: > Hi, > > I want to make sure my deployments have the same version of RXTX jar > and native lib. > > I know the version of the jar can be obtained in the Version class, > but how can I obtain the native version ? > > I know RXTX prints to the console a warning if the version is > different. Is there a way to programatically know is this is the case ? > > I would like to log that to our app's log > There isn't a suggested way of doing that right now. We could move things around and have a static String RXTXVersion.getNativeVersion() in future releases. Is this what you expected? This is not documented in commapi at all. I just tossed that in to catch conflicts while developing. It would be nice to have access in GUI applications though. It may be possible to access RXTXCommDriver.LibVersion right now. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Thu Apr 7 02:51:00 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 09:51:00 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> Message-ID: <4254F474.7020905@emation.pt> >There isn't a suggested way of doing that right now. We could move things >around and have a static String RXTXVersion.getNativeVersion() in future >releases. Is this what you expected? > > Yes, that would be perfect. >This is not documented in commapi at all. I just tossed that in to catch >conflicts while developing. It would be nice to have access in GUI >applications though. > >It may be possible to access RXTXCommDriver.LibVersion right now. > > > I tried, and I don't think it's possible. From taj at www.linux.org.uk Thu Apr 7 03:32:04 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 7 Apr 2005 10:32:04 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4254F474.7020905@emation.pt> References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: On Thu, 7 Apr 2005, Ricardo Trindade wrote: > > >There isn't a suggested way of doing that right now. We could move things > >around and have a static String RXTXVersion.getNativeVersion() in future > >releases. Is this what you expected? > > > > > > Yes, that would be perfect. > The attached should do what you want. You will still need to catch an exception for older versions... -- Trent Jarvi taj at www.linux.org.uk -------------- next part -------------- ? public_version.patch Index: RXTXCommDriver.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXCommDriver.java,v retrieving revision 1.16.2.51 diff -u -r1.16.2.51 RXTXCommDriver.java --- RXTXCommDriver.java 12 Oct 2004 09:13:30 -0000 1.16.2.51 +++ RXTXCommDriver.java 7 Apr 2005 09:29:04 -0000 @@ -54,7 +54,7 @@ the Library. */ String JarVersion = RXTXVersion.getVersion(); - String LibVersion = nativeGetVersion(); + String LibVersion = RXTXVersion.nativeGetVersion(); if ( devel ) { System.out.println("Devel Library"); @@ -76,7 +76,6 @@ /** Get the Serial port prefixes for the running OS */ private String deviceDirectory; private String osName; - private static native String nativeGetVersion(); private native boolean registerKnownPorts(int PortType); private native boolean isPortPrefixValid(String dev); private native boolean testRead(String dev, int type); Index: RXTXVersion.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXVersion.java,v retrieving revision 1.2.2.31 diff -u -r1.2.2.31 RXTXVersion.java --- RXTXVersion.java 16 Oct 2004 16:20:35 -0000 1.2.2.31 +++ RXTXVersion.java 7 Apr 2005 09:29:04 -0000 @@ -36,6 +36,7 @@ private static String Version; static { + System.loadLibrary( "rxtxSerial" ); Version = "RXTX-2.1-7pre20"; } /** @@ -47,4 +48,5 @@ { return(Version); } + public static native String nativeGetVersion(); } Index: SerialImp.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v retrieving revision 1.46.2.181 diff -u -r1.46.2.181 SerialImp.c --- SerialImp.c 17 Oct 2004 09:48:56 -0000 1.46.2.181 +++ SerialImp.c 7 Apr 2005 09:29:07 -0000 @@ -116,6 +116,7 @@ * It will eventually be removed. * */ #define RXTXPort(foo) Java_gnu_io_RXTXPort_ ## foo +#define RXTXVersion(foo) Java_gnu_io_RXTXVersion_ ## foo #define RXTXCommDriver(foo) Java_gnu_io_RXTXCommDriver_ ## foo #if defined(__sun__) || defined(__hpux__) @@ -4001,7 +4002,7 @@ } /*---------------------------------------------------------- -RXTXCommDriver.nativeGetVersion +RXTXVersion.nativeGetVersion accept: none perform: return the current version @@ -4010,9 +4011,10 @@ comments: This is used to avoid mixing versions of the .jar and native library. First introduced in rxtx-1.5-9 + Moved from RXTXCommDriver to RXTXVersion in rxtx-2.1-7 ----------------------------------------------------------*/ -JNIEXPORT jstring JNICALL RXTXCommDriver(nativeGetVersion) (JNIEnv *env, +JNIEXPORT jstring JNICALL RXTXVersion(nativeGetVersion) (JNIEnv *env, jclass jclazz ) { return (*env)->NewStringUTF( env, "RXTX-2.1-7pre20" ); From ricardo.trindade at emation.pt Thu Apr 7 03:45:58 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 10:45:58 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: <42550156.2040908@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050407/05212451/attachment-0006.html From thomas.shulok at lmco.com Thu Apr 7 17:43:11 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Thu, 07 Apr 2005 19:43:11 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi There, I'm attempting to talk RS232 between an embedded Linux box and a Windows box. Everything connects up fine, and I can send and receive a simple sequence of bytes with no problems. However, if around 5 seconds goes by without me sending something, I get the following when I attempt to send. java.io.IOException: Input/output error in writeArray Stack trace: java/lang/Throwable.()V java/lang/Throwable.(Ljava/lang/String;)V java/io/IOException.(Ljava/lang/String;)V gnu/io/RXTXPort.writeArray([BIIZ)V gnu/io/RXTXPort$SerialOutputStream.write([B)V SerialTest.main([Ljava/lang/String;)V If there interval is shorter (say 2 seconds between sends), I have no problems. On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and librxtxSerial-2.0.7pre2.so. Any ideas? Thanks, Thom -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5b23dcf/attachment-0006.html From taj at www.linux.org.uk Thu Apr 7 19:22:36 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:22:36 +0100 (BST) Subject: [Rxtx] Input/output error in writeArray In-Reply-To: References: Message-ID: On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a Windows > box. Everything connects up fine, and I can send and receive a simple > sequence of bytes with no problems. However, if around 5 seconds goes > by without me sending something, I get the following when I attempt to > send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Apr 7 19:24:59 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:24:59 +0100 (BST) Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) Message-ID: hmm. This would not work from applets would it? -- Trent Jarvi taj at www.linux.org.uk ---------- Forwarded message ---------- Date: Thu, 07 Apr 2005 16:05:53 -0400 From: Chris Gaffney To: taj at www.linux.org.uk Subject: RXTX Libraries on Classpath fix Hi, I submitted a patch for RXTX a few weeks ago to allow for loading the native libraries from the classpath. Since sending it to you I found it wasn't working on windows. I've fixed the problem and created a new patch that should replace the older one. The actual change is a one line from a String.equals() to a String.startsWith(). Thanks for a great piece of software, -Chris Gaffney Grand Valley State University -------------- next part -------------- A non-text attachment was scrubbed... Name: libraries_on_classpath_fixed.patch Type: text/x-patch Size: 5617 bytes Desc: Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5d423b8/libraries_on_classpath_fixed-0006.bin From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From thomas.shulok at lmco.com Fri Apr 8 10:38:55 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Fri, 08 Apr 2005 12:38:55 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi Trent, Thanks for the prompt response. Before diving deeper, I was wondering if there is a timeout parameter somewhere in the stack that I have not set properly. Given the nature of the failure (only fails if the line has been idle for a few seconds), it feels like some kind of timeout issue... Thanks again, Thom -----Original Message----- From: rxtx-bounces at mail.linuxgrrls.org [mailto:rxtx-bounces at mail.linuxgrrls.org] On Behalf Of Trent Jarvi Sent: Thursday, April 07, 2005 6:23 PM To: Java RXTX discussion Subject: Re: [Rxtx] Input/output error in writeArray On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a > Windows box. Everything connects up fine, and I can send and receive > a simple sequence of bytes with no problems. However, if around 5 > seconds goes by without me sending something, I get the following when > I attempt to send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at mail.linuxgrrls.org http://mail.linuxgrrls.org/mailman/listinfo/rxtx From ricardo.trindade at emation.pt Mon Apr 4 09:17:23 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Mon, 04 Apr 2005 16:17:23 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot Message-ID: <42515A83.4050907@emation.pt> Hi, I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most recent stable snapshot), and get the following exception : It looks like rxtx has been compiled with jdk 1.5. If this was indeed the case, I think there is a compilation flag that generates code that runs on older jdks. java.lang.UnsupportedClassVersionError: gnu/io/UnsupportedCommOperationException (Unsupported major.minor version 49.0) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at java.net.URLClassLoader.defineClass(URLClassLoader.java:251) at java.net.URLClassLoader.access$100(URLClassLoader.java:55) at java.net.URLClassLoader$1.run(URLClassLoader.java:194) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:187) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:141) I'm trying to run it with 1.4. thanks Ricardo From taj at www.linux.org.uk Tue Apr 5 00:48:12 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 07:48:12 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42515A83.4050907@emation.pt> References: <42515A83.4050907@emation.pt> Message-ID: On Mon, 4 Apr 2005, Ricardo Trindade wrote: > Hi, > > I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most > recent stable snapshot), and get the following exception : > > It looks like rxtx has been compiled with jdk 1.5. If this was > indeed the case, I think there is a compilation flag that generates code > that runs on older jdks. > > java.lang.UnsupportedClassVersionError: > gnu/io/UnsupportedCommOperationException (Unsupported major.minor > version 49.0) [snip] Thanks Ricardo I recompiled the jar with javac -source 1.3 -target 1.3. That should cover most of the JRE's in use today. I also compiled the rxtx 2.0 x86_64 native library which appeared to be missing. I tried looking for flags to pass gcc 4.0 to make the native libraries more backwards compatible but only found options for C++ which is not used in rxtx. I've got a list of other bugs that I'll be going through in the next few weeks but for now I just left them with the same CVS filename - no code changes. ftp://ftp.qbang.org/pub/rxtx/rxtx-2.0-CVS-20050120-bins.tar.gz ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-CVS-20050120-bins.tar.gz -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Tue Apr 5 02:24:33 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 05 Apr 2005 09:24:33 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: References: <42515A83.4050907@emation.pt> Message-ID: <42524B41.3040300@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050405/5919abbb/attachment-0007.html From taj at www.linux.org.uk Tue Apr 5 03:00:29 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 10:00:29 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42524B41.3040300@emation.pt> References: <42515A83.4050907@emation.pt> <42524B41.3040300@emation.pt> Message-ID: On Tue, 5 Apr 2005, Ricardo Trindade wrote: > Will you anounce to the list when a new release is available ? > There will be several incremental releases announced here. Once those are done, we will release 2.1.7 and 2.0.7. -- Trent Jarvi taj at www.linux.org.uk From no_spam at somewhere.com Tue Apr 5 11:55:37 2005 From: no_spam at somewhere.com (no_spam@somewhere.com) Date: Tue, 5 Apr 2005 13:55:37 -0400 Subject: [Rxtx] Closing a port from an event listener results in a deadlock Message-ID: <20050405175537.GA21747@rcog.homelinux.net> On the message I sent on March 14, does anyone had the chance to try the modification? Or was it already fixed? (I haven't searched the archive extensively) Or maybe my message got catched by some spam filters? (it made it to the list archive though) Anyway, I would appreciate some feedback (through the list) Thanks From taj at www.linux.org.uk Tue Apr 5 14:42:28 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 21:42:28 +0100 (BST) Subject: [Rxtx] Closing a port from an event listener results in a deadlock In-Reply-To: <20050405175537.GA21747@rcog.homelinux.net> References: <20050405175537.GA21747@rcog.homelinux.net> Message-ID: On Tue, 5 Apr 2005 no_spam at somewhere.com wrote: > On the message I sent on March 14, does anyone had the chance to try the > modification? > > Or was it already fixed? (I haven't searched the archive extensively) > > Or maybe my message got catched by some spam filters? (it made it to the list > archive though) > > Anyway, I would appreciate some feedback (through the list) > The patch is here http://marc.theaimsgroup.com/?l=rxtx&m=111084488820288&w=2 I have applied this patch to a local copy but will not be doing formal testing for a couple weeks. I do not try to close ports from inside the eventListenter usually so I encourage any feedback also. If there are no problems reported, I expect this will go into rxtx 2.1-7. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Wed Apr 6 08:33:42 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Wed, 06 Apr 2005 15:33:42 +0100 Subject: [Rxtx] getting RXTX version Message-ID: <4253F346.50102@emation.pt> Hi, I want to make sure my deployments have the same version of RXTX jar and native lib. I know the version of the jar can be obtained in the Version class, but how can I obtain the native version ? I know RXTX prints to the console a warning if the version is different. Is there a way to programatically know is this is the case ? I would like to log that to our app's log thanks Ricardo From taj at www.linux.org.uk Wed Apr 6 15:10:20 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 6 Apr 2005 22:10:20 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4253F346.50102@emation.pt> References: <4253F346.50102@emation.pt> Message-ID: On Wed, 6 Apr 2005, Ricardo Trindade wrote: > Hi, > > I want to make sure my deployments have the same version of RXTX jar > and native lib. > > I know the version of the jar can be obtained in the Version class, > but how can I obtain the native version ? > > I know RXTX prints to the console a warning if the version is > different. Is there a way to programatically know is this is the case ? > > I would like to log that to our app's log > There isn't a suggested way of doing that right now. We could move things around and have a static String RXTXVersion.getNativeVersion() in future releases. Is this what you expected? This is not documented in commapi at all. I just tossed that in to catch conflicts while developing. It would be nice to have access in GUI applications though. It may be possible to access RXTXCommDriver.LibVersion right now. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Thu Apr 7 02:51:00 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 09:51:00 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> Message-ID: <4254F474.7020905@emation.pt> >There isn't a suggested way of doing that right now. We could move things >around and have a static String RXTXVersion.getNativeVersion() in future >releases. Is this what you expected? > > Yes, that would be perfect. >This is not documented in commapi at all. I just tossed that in to catch >conflicts while developing. It would be nice to have access in GUI >applications though. > >It may be possible to access RXTXCommDriver.LibVersion right now. > > > I tried, and I don't think it's possible. From taj at www.linux.org.uk Thu Apr 7 03:32:04 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 7 Apr 2005 10:32:04 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4254F474.7020905@emation.pt> References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: On Thu, 7 Apr 2005, Ricardo Trindade wrote: > > >There isn't a suggested way of doing that right now. We could move things > >around and have a static String RXTXVersion.getNativeVersion() in future > >releases. Is this what you expected? > > > > > > Yes, that would be perfect. > The attached should do what you want. You will still need to catch an exception for older versions... -- Trent Jarvi taj at www.linux.org.uk -------------- next part -------------- ? public_version.patch Index: RXTXCommDriver.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXCommDriver.java,v retrieving revision 1.16.2.51 diff -u -r1.16.2.51 RXTXCommDriver.java --- RXTXCommDriver.java 12 Oct 2004 09:13:30 -0000 1.16.2.51 +++ RXTXCommDriver.java 7 Apr 2005 09:29:04 -0000 @@ -54,7 +54,7 @@ the Library. */ String JarVersion = RXTXVersion.getVersion(); - String LibVersion = nativeGetVersion(); + String LibVersion = RXTXVersion.nativeGetVersion(); if ( devel ) { System.out.println("Devel Library"); @@ -76,7 +76,6 @@ /** Get the Serial port prefixes for the running OS */ private String deviceDirectory; private String osName; - private static native String nativeGetVersion(); private native boolean registerKnownPorts(int PortType); private native boolean isPortPrefixValid(String dev); private native boolean testRead(String dev, int type); Index: RXTXVersion.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXVersion.java,v retrieving revision 1.2.2.31 diff -u -r1.2.2.31 RXTXVersion.java --- RXTXVersion.java 16 Oct 2004 16:20:35 -0000 1.2.2.31 +++ RXTXVersion.java 7 Apr 2005 09:29:04 -0000 @@ -36,6 +36,7 @@ private static String Version; static { + System.loadLibrary( "rxtxSerial" ); Version = "RXTX-2.1-7pre20"; } /** @@ -47,4 +48,5 @@ { return(Version); } + public static native String nativeGetVersion(); } Index: SerialImp.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v retrieving revision 1.46.2.181 diff -u -r1.46.2.181 SerialImp.c --- SerialImp.c 17 Oct 2004 09:48:56 -0000 1.46.2.181 +++ SerialImp.c 7 Apr 2005 09:29:07 -0000 @@ -116,6 +116,7 @@ * It will eventually be removed. * */ #define RXTXPort(foo) Java_gnu_io_RXTXPort_ ## foo +#define RXTXVersion(foo) Java_gnu_io_RXTXVersion_ ## foo #define RXTXCommDriver(foo) Java_gnu_io_RXTXCommDriver_ ## foo #if defined(__sun__) || defined(__hpux__) @@ -4001,7 +4002,7 @@ } /*---------------------------------------------------------- -RXTXCommDriver.nativeGetVersion +RXTXVersion.nativeGetVersion accept: none perform: return the current version @@ -4010,9 +4011,10 @@ comments: This is used to avoid mixing versions of the .jar and native library. First introduced in rxtx-1.5-9 + Moved from RXTXCommDriver to RXTXVersion in rxtx-2.1-7 ----------------------------------------------------------*/ -JNIEXPORT jstring JNICALL RXTXCommDriver(nativeGetVersion) (JNIEnv *env, +JNIEXPORT jstring JNICALL RXTXVersion(nativeGetVersion) (JNIEnv *env, jclass jclazz ) { return (*env)->NewStringUTF( env, "RXTX-2.1-7pre20" ); From ricardo.trindade at emation.pt Thu Apr 7 03:45:58 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 10:45:58 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: <42550156.2040908@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050407/05212451/attachment-0007.html From thomas.shulok at lmco.com Thu Apr 7 17:43:11 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Thu, 07 Apr 2005 19:43:11 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi There, I'm attempting to talk RS232 between an embedded Linux box and a Windows box. Everything connects up fine, and I can send and receive a simple sequence of bytes with no problems. However, if around 5 seconds goes by without me sending something, I get the following when I attempt to send. java.io.IOException: Input/output error in writeArray Stack trace: java/lang/Throwable.()V java/lang/Throwable.(Ljava/lang/String;)V java/io/IOException.(Ljava/lang/String;)V gnu/io/RXTXPort.writeArray([BIIZ)V gnu/io/RXTXPort$SerialOutputStream.write([B)V SerialTest.main([Ljava/lang/String;)V If there interval is shorter (say 2 seconds between sends), I have no problems. On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and librxtxSerial-2.0.7pre2.so. Any ideas? Thanks, Thom -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5b23dcf/attachment-0007.html From taj at www.linux.org.uk Thu Apr 7 19:22:36 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:22:36 +0100 (BST) Subject: [Rxtx] Input/output error in writeArray In-Reply-To: References: Message-ID: On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a Windows > box. Everything connects up fine, and I can send and receive a simple > sequence of bytes with no problems. However, if around 5 seconds goes > by without me sending something, I get the following when I attempt to > send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Apr 7 19:24:59 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:24:59 +0100 (BST) Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) Message-ID: hmm. This would not work from applets would it? -- Trent Jarvi taj at www.linux.org.uk ---------- Forwarded message ---------- Date: Thu, 07 Apr 2005 16:05:53 -0400 From: Chris Gaffney To: taj at www.linux.org.uk Subject: RXTX Libraries on Classpath fix Hi, I submitted a patch for RXTX a few weeks ago to allow for loading the native libraries from the classpath. Since sending it to you I found it wasn't working on windows. I've fixed the problem and created a new patch that should replace the older one. The actual change is a one line from a String.equals() to a String.startsWith(). Thanks for a great piece of software, -Chris Gaffney Grand Valley State University -------------- next part -------------- A non-text attachment was scrubbed... Name: libraries_on_classpath_fixed.patch Type: text/x-patch Size: 5617 bytes Desc: Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5d423b8/libraries_on_classpath_fixed-0007.bin From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From thomas.shulok at lmco.com Fri Apr 8 10:38:55 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Fri, 08 Apr 2005 12:38:55 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi Trent, Thanks for the prompt response. Before diving deeper, I was wondering if there is a timeout parameter somewhere in the stack that I have not set properly. Given the nature of the failure (only fails if the line has been idle for a few seconds), it feels like some kind of timeout issue... Thanks again, Thom -----Original Message----- From: rxtx-bounces at mail.linuxgrrls.org [mailto:rxtx-bounces at mail.linuxgrrls.org] On Behalf Of Trent Jarvi Sent: Thursday, April 07, 2005 6:23 PM To: Java RXTX discussion Subject: Re: [Rxtx] Input/output error in writeArray On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a > Windows box. Everything connects up fine, and I can send and receive > a simple sequence of bytes with no problems. However, if around 5 > seconds goes by without me sending something, I get the following when > I attempt to send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at mail.linuxgrrls.org http://mail.linuxgrrls.org/mailman/listinfo/rxtx From ricardo.trindade at emation.pt Mon Apr 4 09:17:23 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Mon, 04 Apr 2005 16:17:23 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot Message-ID: <42515A83.4050907@emation.pt> Hi, I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most recent stable snapshot), and get the following exception : It looks like rxtx has been compiled with jdk 1.5. If this was indeed the case, I think there is a compilation flag that generates code that runs on older jdks. java.lang.UnsupportedClassVersionError: gnu/io/UnsupportedCommOperationException (Unsupported major.minor version 49.0) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at java.net.URLClassLoader.defineClass(URLClassLoader.java:251) at java.net.URLClassLoader.access$100(URLClassLoader.java:55) at java.net.URLClassLoader$1.run(URLClassLoader.java:194) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:187) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:141) I'm trying to run it with 1.4. thanks Ricardo From taj at www.linux.org.uk Tue Apr 5 00:48:12 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 07:48:12 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42515A83.4050907@emation.pt> References: <42515A83.4050907@emation.pt> Message-ID: On Mon, 4 Apr 2005, Ricardo Trindade wrote: > Hi, > > I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most > recent stable snapshot), and get the following exception : > > It looks like rxtx has been compiled with jdk 1.5. If this was > indeed the case, I think there is a compilation flag that generates code > that runs on older jdks. > > java.lang.UnsupportedClassVersionError: > gnu/io/UnsupportedCommOperationException (Unsupported major.minor > version 49.0) [snip] Thanks Ricardo I recompiled the jar with javac -source 1.3 -target 1.3. That should cover most of the JRE's in use today. I also compiled the rxtx 2.0 x86_64 native library which appeared to be missing. I tried looking for flags to pass gcc 4.0 to make the native libraries more backwards compatible but only found options for C++ which is not used in rxtx. I've got a list of other bugs that I'll be going through in the next few weeks but for now I just left them with the same CVS filename - no code changes. ftp://ftp.qbang.org/pub/rxtx/rxtx-2.0-CVS-20050120-bins.tar.gz ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-CVS-20050120-bins.tar.gz -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Tue Apr 5 02:24:33 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 05 Apr 2005 09:24:33 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: References: <42515A83.4050907@emation.pt> Message-ID: <42524B41.3040300@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050405/5919abbb/attachment-0008.html From taj at www.linux.org.uk Tue Apr 5 03:00:29 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 10:00:29 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42524B41.3040300@emation.pt> References: <42515A83.4050907@emation.pt> <42524B41.3040300@emation.pt> Message-ID: On Tue, 5 Apr 2005, Ricardo Trindade wrote: > Will you anounce to the list when a new release is available ? > There will be several incremental releases announced here. Once those are done, we will release 2.1.7 and 2.0.7. -- Trent Jarvi taj at www.linux.org.uk From no_spam at somewhere.com Tue Apr 5 11:55:37 2005 From: no_spam at somewhere.com (no_spam@somewhere.com) Date: Tue, 5 Apr 2005 13:55:37 -0400 Subject: [Rxtx] Closing a port from an event listener results in a deadlock Message-ID: <20050405175537.GA21747@rcog.homelinux.net> On the message I sent on March 14, does anyone had the chance to try the modification? Or was it already fixed? (I haven't searched the archive extensively) Or maybe my message got catched by some spam filters? (it made it to the list archive though) Anyway, I would appreciate some feedback (through the list) Thanks From taj at www.linux.org.uk Tue Apr 5 14:42:28 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 21:42:28 +0100 (BST) Subject: [Rxtx] Closing a port from an event listener results in a deadlock In-Reply-To: <20050405175537.GA21747@rcog.homelinux.net> References: <20050405175537.GA21747@rcog.homelinux.net> Message-ID: On Tue, 5 Apr 2005 no_spam at somewhere.com wrote: > On the message I sent on March 14, does anyone had the chance to try the > modification? > > Or was it already fixed? (I haven't searched the archive extensively) > > Or maybe my message got catched by some spam filters? (it made it to the list > archive though) > > Anyway, I would appreciate some feedback (through the list) > The patch is here http://marc.theaimsgroup.com/?l=rxtx&m=111084488820288&w=2 I have applied this patch to a local copy but will not be doing formal testing for a couple weeks. I do not try to close ports from inside the eventListenter usually so I encourage any feedback also. If there are no problems reported, I expect this will go into rxtx 2.1-7. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Wed Apr 6 08:33:42 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Wed, 06 Apr 2005 15:33:42 +0100 Subject: [Rxtx] getting RXTX version Message-ID: <4253F346.50102@emation.pt> Hi, I want to make sure my deployments have the same version of RXTX jar and native lib. I know the version of the jar can be obtained in the Version class, but how can I obtain the native version ? I know RXTX prints to the console a warning if the version is different. Is there a way to programatically know is this is the case ? I would like to log that to our app's log thanks Ricardo From taj at www.linux.org.uk Wed Apr 6 15:10:20 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 6 Apr 2005 22:10:20 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4253F346.50102@emation.pt> References: <4253F346.50102@emation.pt> Message-ID: On Wed, 6 Apr 2005, Ricardo Trindade wrote: > Hi, > > I want to make sure my deployments have the same version of RXTX jar > and native lib. > > I know the version of the jar can be obtained in the Version class, > but how can I obtain the native version ? > > I know RXTX prints to the console a warning if the version is > different. Is there a way to programatically know is this is the case ? > > I would like to log that to our app's log > There isn't a suggested way of doing that right now. We could move things around and have a static String RXTXVersion.getNativeVersion() in future releases. Is this what you expected? This is not documented in commapi at all. I just tossed that in to catch conflicts while developing. It would be nice to have access in GUI applications though. It may be possible to access RXTXCommDriver.LibVersion right now. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Thu Apr 7 02:51:00 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 09:51:00 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> Message-ID: <4254F474.7020905@emation.pt> >There isn't a suggested way of doing that right now. We could move things >around and have a static String RXTXVersion.getNativeVersion() in future >releases. Is this what you expected? > > Yes, that would be perfect. >This is not documented in commapi at all. I just tossed that in to catch >conflicts while developing. It would be nice to have access in GUI >applications though. > >It may be possible to access RXTXCommDriver.LibVersion right now. > > > I tried, and I don't think it's possible. From taj at www.linux.org.uk Thu Apr 7 03:32:04 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 7 Apr 2005 10:32:04 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4254F474.7020905@emation.pt> References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: On Thu, 7 Apr 2005, Ricardo Trindade wrote: > > >There isn't a suggested way of doing that right now. We could move things > >around and have a static String RXTXVersion.getNativeVersion() in future > >releases. Is this what you expected? > > > > > > Yes, that would be perfect. > The attached should do what you want. You will still need to catch an exception for older versions... -- Trent Jarvi taj at www.linux.org.uk -------------- next part -------------- ? public_version.patch Index: RXTXCommDriver.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXCommDriver.java,v retrieving revision 1.16.2.51 diff -u -r1.16.2.51 RXTXCommDriver.java --- RXTXCommDriver.java 12 Oct 2004 09:13:30 -0000 1.16.2.51 +++ RXTXCommDriver.java 7 Apr 2005 09:29:04 -0000 @@ -54,7 +54,7 @@ the Library. */ String JarVersion = RXTXVersion.getVersion(); - String LibVersion = nativeGetVersion(); + String LibVersion = RXTXVersion.nativeGetVersion(); if ( devel ) { System.out.println("Devel Library"); @@ -76,7 +76,6 @@ /** Get the Serial port prefixes for the running OS */ private String deviceDirectory; private String osName; - private static native String nativeGetVersion(); private native boolean registerKnownPorts(int PortType); private native boolean isPortPrefixValid(String dev); private native boolean testRead(String dev, int type); Index: RXTXVersion.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXVersion.java,v retrieving revision 1.2.2.31 diff -u -r1.2.2.31 RXTXVersion.java --- RXTXVersion.java 16 Oct 2004 16:20:35 -0000 1.2.2.31 +++ RXTXVersion.java 7 Apr 2005 09:29:04 -0000 @@ -36,6 +36,7 @@ private static String Version; static { + System.loadLibrary( "rxtxSerial" ); Version = "RXTX-2.1-7pre20"; } /** @@ -47,4 +48,5 @@ { return(Version); } + public static native String nativeGetVersion(); } Index: SerialImp.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v retrieving revision 1.46.2.181 diff -u -r1.46.2.181 SerialImp.c --- SerialImp.c 17 Oct 2004 09:48:56 -0000 1.46.2.181 +++ SerialImp.c 7 Apr 2005 09:29:07 -0000 @@ -116,6 +116,7 @@ * It will eventually be removed. * */ #define RXTXPort(foo) Java_gnu_io_RXTXPort_ ## foo +#define RXTXVersion(foo) Java_gnu_io_RXTXVersion_ ## foo #define RXTXCommDriver(foo) Java_gnu_io_RXTXCommDriver_ ## foo #if defined(__sun__) || defined(__hpux__) @@ -4001,7 +4002,7 @@ } /*---------------------------------------------------------- -RXTXCommDriver.nativeGetVersion +RXTXVersion.nativeGetVersion accept: none perform: return the current version @@ -4010,9 +4011,10 @@ comments: This is used to avoid mixing versions of the .jar and native library. First introduced in rxtx-1.5-9 + Moved from RXTXCommDriver to RXTXVersion in rxtx-2.1-7 ----------------------------------------------------------*/ -JNIEXPORT jstring JNICALL RXTXCommDriver(nativeGetVersion) (JNIEnv *env, +JNIEXPORT jstring JNICALL RXTXVersion(nativeGetVersion) (JNIEnv *env, jclass jclazz ) { return (*env)->NewStringUTF( env, "RXTX-2.1-7pre20" ); From ricardo.trindade at emation.pt Thu Apr 7 03:45:58 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 10:45:58 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: <42550156.2040908@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050407/05212451/attachment-0008.html From thomas.shulok at lmco.com Thu Apr 7 17:43:11 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Thu, 07 Apr 2005 19:43:11 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi There, I'm attempting to talk RS232 between an embedded Linux box and a Windows box. Everything connects up fine, and I can send and receive a simple sequence of bytes with no problems. However, if around 5 seconds goes by without me sending something, I get the following when I attempt to send. java.io.IOException: Input/output error in writeArray Stack trace: java/lang/Throwable.()V java/lang/Throwable.(Ljava/lang/String;)V java/io/IOException.(Ljava/lang/String;)V gnu/io/RXTXPort.writeArray([BIIZ)V gnu/io/RXTXPort$SerialOutputStream.write([B)V SerialTest.main([Ljava/lang/String;)V If there interval is shorter (say 2 seconds between sends), I have no problems. On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and librxtxSerial-2.0.7pre2.so. Any ideas? Thanks, Thom -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5b23dcf/attachment-0008.html From taj at www.linux.org.uk Thu Apr 7 19:22:36 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:22:36 +0100 (BST) Subject: [Rxtx] Input/output error in writeArray In-Reply-To: References: Message-ID: On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a Windows > box. Everything connects up fine, and I can send and receive a simple > sequence of bytes with no problems. However, if around 5 seconds goes > by without me sending something, I get the following when I attempt to > send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Apr 7 19:24:59 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:24:59 +0100 (BST) Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) Message-ID: hmm. This would not work from applets would it? -- Trent Jarvi taj at www.linux.org.uk ---------- Forwarded message ---------- Date: Thu, 07 Apr 2005 16:05:53 -0400 From: Chris Gaffney To: taj at www.linux.org.uk Subject: RXTX Libraries on Classpath fix Hi, I submitted a patch for RXTX a few weeks ago to allow for loading the native libraries from the classpath. Since sending it to you I found it wasn't working on windows. I've fixed the problem and created a new patch that should replace the older one. The actual change is a one line from a String.equals() to a String.startsWith(). Thanks for a great piece of software, -Chris Gaffney Grand Valley State University -------------- next part -------------- A non-text attachment was scrubbed... Name: libraries_on_classpath_fixed.patch Type: text/x-patch Size: 5617 bytes Desc: Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5d423b8/libraries_on_classpath_fixed-0008.bin From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From thomas.shulok at lmco.com Fri Apr 8 10:38:55 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Fri, 08 Apr 2005 12:38:55 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi Trent, Thanks for the prompt response. Before diving deeper, I was wondering if there is a timeout parameter somewhere in the stack that I have not set properly. Given the nature of the failure (only fails if the line has been idle for a few seconds), it feels like some kind of timeout issue... Thanks again, Thom -----Original Message----- From: rxtx-bounces at mail.linuxgrrls.org [mailto:rxtx-bounces at mail.linuxgrrls.org] On Behalf Of Trent Jarvi Sent: Thursday, April 07, 2005 6:23 PM To: Java RXTX discussion Subject: Re: [Rxtx] Input/output error in writeArray On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a > Windows box. Everything connects up fine, and I can send and receive > a simple sequence of bytes with no problems. However, if around 5 > seconds goes by without me sending something, I get the following when > I attempt to send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at mail.linuxgrrls.org http://mail.linuxgrrls.org/mailman/listinfo/rxtx From ricardo.trindade at emation.pt Mon Apr 4 09:17:23 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Mon, 04 Apr 2005 16:17:23 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot Message-ID: <42515A83.4050907@emation.pt> Hi, I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most recent stable snapshot), and get the following exception : It looks like rxtx has been compiled with jdk 1.5. If this was indeed the case, I think there is a compilation flag that generates code that runs on older jdks. java.lang.UnsupportedClassVersionError: gnu/io/UnsupportedCommOperationException (Unsupported major.minor version 49.0) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at java.net.URLClassLoader.defineClass(URLClassLoader.java:251) at java.net.URLClassLoader.access$100(URLClassLoader.java:55) at java.net.URLClassLoader$1.run(URLClassLoader.java:194) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:187) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:141) I'm trying to run it with 1.4. thanks Ricardo From taj at www.linux.org.uk Tue Apr 5 00:48:12 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 07:48:12 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42515A83.4050907@emation.pt> References: <42515A83.4050907@emation.pt> Message-ID: On Mon, 4 Apr 2005, Ricardo Trindade wrote: > Hi, > > I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most > recent stable snapshot), and get the following exception : > > It looks like rxtx has been compiled with jdk 1.5. If this was > indeed the case, I think there is a compilation flag that generates code > that runs on older jdks. > > java.lang.UnsupportedClassVersionError: > gnu/io/UnsupportedCommOperationException (Unsupported major.minor > version 49.0) [snip] Thanks Ricardo I recompiled the jar with javac -source 1.3 -target 1.3. That should cover most of the JRE's in use today. I also compiled the rxtx 2.0 x86_64 native library which appeared to be missing. I tried looking for flags to pass gcc 4.0 to make the native libraries more backwards compatible but only found options for C++ which is not used in rxtx. I've got a list of other bugs that I'll be going through in the next few weeks but for now I just left them with the same CVS filename - no code changes. ftp://ftp.qbang.org/pub/rxtx/rxtx-2.0-CVS-20050120-bins.tar.gz ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-CVS-20050120-bins.tar.gz -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Tue Apr 5 02:24:33 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 05 Apr 2005 09:24:33 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: References: <42515A83.4050907@emation.pt> Message-ID: <42524B41.3040300@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050405/5919abbb/attachment-0009.html From taj at www.linux.org.uk Tue Apr 5 03:00:29 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 10:00:29 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42524B41.3040300@emation.pt> References: <42515A83.4050907@emation.pt> <42524B41.3040300@emation.pt> Message-ID: On Tue, 5 Apr 2005, Ricardo Trindade wrote: > Will you anounce to the list when a new release is available ? > There will be several incremental releases announced here. Once those are done, we will release 2.1.7 and 2.0.7. -- Trent Jarvi taj at www.linux.org.uk From no_spam at somewhere.com Tue Apr 5 11:55:37 2005 From: no_spam at somewhere.com (no_spam@somewhere.com) Date: Tue, 5 Apr 2005 13:55:37 -0400 Subject: [Rxtx] Closing a port from an event listener results in a deadlock Message-ID: <20050405175537.GA21747@rcog.homelinux.net> On the message I sent on March 14, does anyone had the chance to try the modification? Or was it already fixed? (I haven't searched the archive extensively) Or maybe my message got catched by some spam filters? (it made it to the list archive though) Anyway, I would appreciate some feedback (through the list) Thanks From taj at www.linux.org.uk Tue Apr 5 14:42:28 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 21:42:28 +0100 (BST) Subject: [Rxtx] Closing a port from an event listener results in a deadlock In-Reply-To: <20050405175537.GA21747@rcog.homelinux.net> References: <20050405175537.GA21747@rcog.homelinux.net> Message-ID: On Tue, 5 Apr 2005 no_spam at somewhere.com wrote: > On the message I sent on March 14, does anyone had the chance to try the > modification? > > Or was it already fixed? (I haven't searched the archive extensively) > > Or maybe my message got catched by some spam filters? (it made it to the list > archive though) > > Anyway, I would appreciate some feedback (through the list) > The patch is here http://marc.theaimsgroup.com/?l=rxtx&m=111084488820288&w=2 I have applied this patch to a local copy but will not be doing formal testing for a couple weeks. I do not try to close ports from inside the eventListenter usually so I encourage any feedback also. If there are no problems reported, I expect this will go into rxtx 2.1-7. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Wed Apr 6 08:33:42 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Wed, 06 Apr 2005 15:33:42 +0100 Subject: [Rxtx] getting RXTX version Message-ID: <4253F346.50102@emation.pt> Hi, I want to make sure my deployments have the same version of RXTX jar and native lib. I know the version of the jar can be obtained in the Version class, but how can I obtain the native version ? I know RXTX prints to the console a warning if the version is different. Is there a way to programatically know is this is the case ? I would like to log that to our app's log thanks Ricardo From taj at www.linux.org.uk Wed Apr 6 15:10:20 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 6 Apr 2005 22:10:20 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4253F346.50102@emation.pt> References: <4253F346.50102@emation.pt> Message-ID: On Wed, 6 Apr 2005, Ricardo Trindade wrote: > Hi, > > I want to make sure my deployments have the same version of RXTX jar > and native lib. > > I know the version of the jar can be obtained in the Version class, > but how can I obtain the native version ? > > I know RXTX prints to the console a warning if the version is > different. Is there a way to programatically know is this is the case ? > > I would like to log that to our app's log > There isn't a suggested way of doing that right now. We could move things around and have a static String RXTXVersion.getNativeVersion() in future releases. Is this what you expected? This is not documented in commapi at all. I just tossed that in to catch conflicts while developing. It would be nice to have access in GUI applications though. It may be possible to access RXTXCommDriver.LibVersion right now. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Thu Apr 7 02:51:00 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 09:51:00 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> Message-ID: <4254F474.7020905@emation.pt> >There isn't a suggested way of doing that right now. We could move things >around and have a static String RXTXVersion.getNativeVersion() in future >releases. Is this what you expected? > > Yes, that would be perfect. >This is not documented in commapi at all. I just tossed that in to catch >conflicts while developing. It would be nice to have access in GUI >applications though. > >It may be possible to access RXTXCommDriver.LibVersion right now. > > > I tried, and I don't think it's possible. From taj at www.linux.org.uk Thu Apr 7 03:32:04 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 7 Apr 2005 10:32:04 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4254F474.7020905@emation.pt> References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: On Thu, 7 Apr 2005, Ricardo Trindade wrote: > > >There isn't a suggested way of doing that right now. We could move things > >around and have a static String RXTXVersion.getNativeVersion() in future > >releases. Is this what you expected? > > > > > > Yes, that would be perfect. > The attached should do what you want. You will still need to catch an exception for older versions... -- Trent Jarvi taj at www.linux.org.uk -------------- next part -------------- ? public_version.patch Index: RXTXCommDriver.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXCommDriver.java,v retrieving revision 1.16.2.51 diff -u -r1.16.2.51 RXTXCommDriver.java --- RXTXCommDriver.java 12 Oct 2004 09:13:30 -0000 1.16.2.51 +++ RXTXCommDriver.java 7 Apr 2005 09:29:04 -0000 @@ -54,7 +54,7 @@ the Library. */ String JarVersion = RXTXVersion.getVersion(); - String LibVersion = nativeGetVersion(); + String LibVersion = RXTXVersion.nativeGetVersion(); if ( devel ) { System.out.println("Devel Library"); @@ -76,7 +76,6 @@ /** Get the Serial port prefixes for the running OS */ private String deviceDirectory; private String osName; - private static native String nativeGetVersion(); private native boolean registerKnownPorts(int PortType); private native boolean isPortPrefixValid(String dev); private native boolean testRead(String dev, int type); Index: RXTXVersion.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXVersion.java,v retrieving revision 1.2.2.31 diff -u -r1.2.2.31 RXTXVersion.java --- RXTXVersion.java 16 Oct 2004 16:20:35 -0000 1.2.2.31 +++ RXTXVersion.java 7 Apr 2005 09:29:04 -0000 @@ -36,6 +36,7 @@ private static String Version; static { + System.loadLibrary( "rxtxSerial" ); Version = "RXTX-2.1-7pre20"; } /** @@ -47,4 +48,5 @@ { return(Version); } + public static native String nativeGetVersion(); } Index: SerialImp.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v retrieving revision 1.46.2.181 diff -u -r1.46.2.181 SerialImp.c --- SerialImp.c 17 Oct 2004 09:48:56 -0000 1.46.2.181 +++ SerialImp.c 7 Apr 2005 09:29:07 -0000 @@ -116,6 +116,7 @@ * It will eventually be removed. * */ #define RXTXPort(foo) Java_gnu_io_RXTXPort_ ## foo +#define RXTXVersion(foo) Java_gnu_io_RXTXVersion_ ## foo #define RXTXCommDriver(foo) Java_gnu_io_RXTXCommDriver_ ## foo #if defined(__sun__) || defined(__hpux__) @@ -4001,7 +4002,7 @@ } /*---------------------------------------------------------- -RXTXCommDriver.nativeGetVersion +RXTXVersion.nativeGetVersion accept: none perform: return the current version @@ -4010,9 +4011,10 @@ comments: This is used to avoid mixing versions of the .jar and native library. First introduced in rxtx-1.5-9 + Moved from RXTXCommDriver to RXTXVersion in rxtx-2.1-7 ----------------------------------------------------------*/ -JNIEXPORT jstring JNICALL RXTXCommDriver(nativeGetVersion) (JNIEnv *env, +JNIEXPORT jstring JNICALL RXTXVersion(nativeGetVersion) (JNIEnv *env, jclass jclazz ) { return (*env)->NewStringUTF( env, "RXTX-2.1-7pre20" ); From ricardo.trindade at emation.pt Thu Apr 7 03:45:58 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 10:45:58 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: <42550156.2040908@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050407/05212451/attachment-0009.html From thomas.shulok at lmco.com Thu Apr 7 17:43:11 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Thu, 07 Apr 2005 19:43:11 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi There, I'm attempting to talk RS232 between an embedded Linux box and a Windows box. Everything connects up fine, and I can send and receive a simple sequence of bytes with no problems. However, if around 5 seconds goes by without me sending something, I get the following when I attempt to send. java.io.IOException: Input/output error in writeArray Stack trace: java/lang/Throwable.()V java/lang/Throwable.(Ljava/lang/String;)V java/io/IOException.(Ljava/lang/String;)V gnu/io/RXTXPort.writeArray([BIIZ)V gnu/io/RXTXPort$SerialOutputStream.write([B)V SerialTest.main([Ljava/lang/String;)V If there interval is shorter (say 2 seconds between sends), I have no problems. On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and librxtxSerial-2.0.7pre2.so. Any ideas? Thanks, Thom -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5b23dcf/attachment-0009.html From taj at www.linux.org.uk Thu Apr 7 19:22:36 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:22:36 +0100 (BST) Subject: [Rxtx] Input/output error in writeArray In-Reply-To: References: Message-ID: On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a Windows > box. Everything connects up fine, and I can send and receive a simple > sequence of bytes with no problems. However, if around 5 seconds goes > by without me sending something, I get the following when I attempt to > send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Apr 7 19:24:59 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:24:59 +0100 (BST) Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) Message-ID: hmm. This would not work from applets would it? -- Trent Jarvi taj at www.linux.org.uk ---------- Forwarded message ---------- Date: Thu, 07 Apr 2005 16:05:53 -0400 From: Chris Gaffney To: taj at www.linux.org.uk Subject: RXTX Libraries on Classpath fix Hi, I submitted a patch for RXTX a few weeks ago to allow for loading the native libraries from the classpath. Since sending it to you I found it wasn't working on windows. I've fixed the problem and created a new patch that should replace the older one. The actual change is a one line from a String.equals() to a String.startsWith(). Thanks for a great piece of software, -Chris Gaffney Grand Valley State University -------------- next part -------------- A non-text attachment was scrubbed... Name: libraries_on_classpath_fixed.patch Type: text/x-patch Size: 5617 bytes Desc: Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5d423b8/libraries_on_classpath_fixed-0009.bin From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From thomas.shulok at lmco.com Fri Apr 8 10:38:55 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Fri, 08 Apr 2005 12:38:55 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi Trent, Thanks for the prompt response. Before diving deeper, I was wondering if there is a timeout parameter somewhere in the stack that I have not set properly. Given the nature of the failure (only fails if the line has been idle for a few seconds), it feels like some kind of timeout issue... Thanks again, Thom -----Original Message----- From: rxtx-bounces at mail.linuxgrrls.org [mailto:rxtx-bounces at mail.linuxgrrls.org] On Behalf Of Trent Jarvi Sent: Thursday, April 07, 2005 6:23 PM To: Java RXTX discussion Subject: Re: [Rxtx] Input/output error in writeArray On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a > Windows box. Everything connects up fine, and I can send and receive > a simple sequence of bytes with no problems. However, if around 5 > seconds goes by without me sending something, I get the following when > I attempt to send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at mail.linuxgrrls.org http://mail.linuxgrrls.org/mailman/listinfo/rxtx From ricardo.trindade at emation.pt Mon Apr 4 09:17:23 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Mon, 04 Apr 2005 16:17:23 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot Message-ID: <42515A83.4050907@emation.pt> Hi, I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most recent stable snapshot), and get the following exception : It looks like rxtx has been compiled with jdk 1.5. If this was indeed the case, I think there is a compilation flag that generates code that runs on older jdks. java.lang.UnsupportedClassVersionError: gnu/io/UnsupportedCommOperationException (Unsupported major.minor version 49.0) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at java.net.URLClassLoader.defineClass(URLClassLoader.java:251) at java.net.URLClassLoader.access$100(URLClassLoader.java:55) at java.net.URLClassLoader$1.run(URLClassLoader.java:194) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:187) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:141) I'm trying to run it with 1.4. thanks Ricardo From taj at www.linux.org.uk Tue Apr 5 00:48:12 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 07:48:12 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42515A83.4050907@emation.pt> References: <42515A83.4050907@emation.pt> Message-ID: On Mon, 4 Apr 2005, Ricardo Trindade wrote: > Hi, > > I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most > recent stable snapshot), and get the following exception : > > It looks like rxtx has been compiled with jdk 1.5. If this was > indeed the case, I think there is a compilation flag that generates code > that runs on older jdks. > > java.lang.UnsupportedClassVersionError: > gnu/io/UnsupportedCommOperationException (Unsupported major.minor > version 49.0) [snip] Thanks Ricardo I recompiled the jar with javac -source 1.3 -target 1.3. That should cover most of the JRE's in use today. I also compiled the rxtx 2.0 x86_64 native library which appeared to be missing. I tried looking for flags to pass gcc 4.0 to make the native libraries more backwards compatible but only found options for C++ which is not used in rxtx. I've got a list of other bugs that I'll be going through in the next few weeks but for now I just left them with the same CVS filename - no code changes. ftp://ftp.qbang.org/pub/rxtx/rxtx-2.0-CVS-20050120-bins.tar.gz ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-CVS-20050120-bins.tar.gz -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Tue Apr 5 02:24:33 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 05 Apr 2005 09:24:33 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: References: <42515A83.4050907@emation.pt> Message-ID: <42524B41.3040300@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050405/5919abbb/attachment-0010.html From taj at www.linux.org.uk Tue Apr 5 03:00:29 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 10:00:29 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42524B41.3040300@emation.pt> References: <42515A83.4050907@emation.pt> <42524B41.3040300@emation.pt> Message-ID: On Tue, 5 Apr 2005, Ricardo Trindade wrote: > Will you anounce to the list when a new release is available ? > There will be several incremental releases announced here. Once those are done, we will release 2.1.7 and 2.0.7. -- Trent Jarvi taj at www.linux.org.uk From no_spam at somewhere.com Tue Apr 5 11:55:37 2005 From: no_spam at somewhere.com (no_spam@somewhere.com) Date: Tue, 5 Apr 2005 13:55:37 -0400 Subject: [Rxtx] Closing a port from an event listener results in a deadlock Message-ID: <20050405175537.GA21747@rcog.homelinux.net> On the message I sent on March 14, does anyone had the chance to try the modification? Or was it already fixed? (I haven't searched the archive extensively) Or maybe my message got catched by some spam filters? (it made it to the list archive though) Anyway, I would appreciate some feedback (through the list) Thanks From taj at www.linux.org.uk Tue Apr 5 14:42:28 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 21:42:28 +0100 (BST) Subject: [Rxtx] Closing a port from an event listener results in a deadlock In-Reply-To: <20050405175537.GA21747@rcog.homelinux.net> References: <20050405175537.GA21747@rcog.homelinux.net> Message-ID: On Tue, 5 Apr 2005 no_spam at somewhere.com wrote: > On the message I sent on March 14, does anyone had the chance to try the > modification? > > Or was it already fixed? (I haven't searched the archive extensively) > > Or maybe my message got catched by some spam filters? (it made it to the list > archive though) > > Anyway, I would appreciate some feedback (through the list) > The patch is here http://marc.theaimsgroup.com/?l=rxtx&m=111084488820288&w=2 I have applied this patch to a local copy but will not be doing formal testing for a couple weeks. I do not try to close ports from inside the eventListenter usually so I encourage any feedback also. If there are no problems reported, I expect this will go into rxtx 2.1-7. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Wed Apr 6 08:33:42 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Wed, 06 Apr 2005 15:33:42 +0100 Subject: [Rxtx] getting RXTX version Message-ID: <4253F346.50102@emation.pt> Hi, I want to make sure my deployments have the same version of RXTX jar and native lib. I know the version of the jar can be obtained in the Version class, but how can I obtain the native version ? I know RXTX prints to the console a warning if the version is different. Is there a way to programatically know is this is the case ? I would like to log that to our app's log thanks Ricardo From taj at www.linux.org.uk Wed Apr 6 15:10:20 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 6 Apr 2005 22:10:20 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4253F346.50102@emation.pt> References: <4253F346.50102@emation.pt> Message-ID: On Wed, 6 Apr 2005, Ricardo Trindade wrote: > Hi, > > I want to make sure my deployments have the same version of RXTX jar > and native lib. > > I know the version of the jar can be obtained in the Version class, > but how can I obtain the native version ? > > I know RXTX prints to the console a warning if the version is > different. Is there a way to programatically know is this is the case ? > > I would like to log that to our app's log > There isn't a suggested way of doing that right now. We could move things around and have a static String RXTXVersion.getNativeVersion() in future releases. Is this what you expected? This is not documented in commapi at all. I just tossed that in to catch conflicts while developing. It would be nice to have access in GUI applications though. It may be possible to access RXTXCommDriver.LibVersion right now. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Thu Apr 7 02:51:00 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 09:51:00 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> Message-ID: <4254F474.7020905@emation.pt> >There isn't a suggested way of doing that right now. We could move things >around and have a static String RXTXVersion.getNativeVersion() in future >releases. Is this what you expected? > > Yes, that would be perfect. >This is not documented in commapi at all. I just tossed that in to catch >conflicts while developing. It would be nice to have access in GUI >applications though. > >It may be possible to access RXTXCommDriver.LibVersion right now. > > > I tried, and I don't think it's possible. From taj at www.linux.org.uk Thu Apr 7 03:32:04 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 7 Apr 2005 10:32:04 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4254F474.7020905@emation.pt> References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: On Thu, 7 Apr 2005, Ricardo Trindade wrote: > > >There isn't a suggested way of doing that right now. We could move things > >around and have a static String RXTXVersion.getNativeVersion() in future > >releases. Is this what you expected? > > > > > > Yes, that would be perfect. > The attached should do what you want. You will still need to catch an exception for older versions... -- Trent Jarvi taj at www.linux.org.uk -------------- next part -------------- ? public_version.patch Index: RXTXCommDriver.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXCommDriver.java,v retrieving revision 1.16.2.51 diff -u -r1.16.2.51 RXTXCommDriver.java --- RXTXCommDriver.java 12 Oct 2004 09:13:30 -0000 1.16.2.51 +++ RXTXCommDriver.java 7 Apr 2005 09:29:04 -0000 @@ -54,7 +54,7 @@ the Library. */ String JarVersion = RXTXVersion.getVersion(); - String LibVersion = nativeGetVersion(); + String LibVersion = RXTXVersion.nativeGetVersion(); if ( devel ) { System.out.println("Devel Library"); @@ -76,7 +76,6 @@ /** Get the Serial port prefixes for the running OS */ private String deviceDirectory; private String osName; - private static native String nativeGetVersion(); private native boolean registerKnownPorts(int PortType); private native boolean isPortPrefixValid(String dev); private native boolean testRead(String dev, int type); Index: RXTXVersion.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXVersion.java,v retrieving revision 1.2.2.31 diff -u -r1.2.2.31 RXTXVersion.java --- RXTXVersion.java 16 Oct 2004 16:20:35 -0000 1.2.2.31 +++ RXTXVersion.java 7 Apr 2005 09:29:04 -0000 @@ -36,6 +36,7 @@ private static String Version; static { + System.loadLibrary( "rxtxSerial" ); Version = "RXTX-2.1-7pre20"; } /** @@ -47,4 +48,5 @@ { return(Version); } + public static native String nativeGetVersion(); } Index: SerialImp.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v retrieving revision 1.46.2.181 diff -u -r1.46.2.181 SerialImp.c --- SerialImp.c 17 Oct 2004 09:48:56 -0000 1.46.2.181 +++ SerialImp.c 7 Apr 2005 09:29:07 -0000 @@ -116,6 +116,7 @@ * It will eventually be removed. * */ #define RXTXPort(foo) Java_gnu_io_RXTXPort_ ## foo +#define RXTXVersion(foo) Java_gnu_io_RXTXVersion_ ## foo #define RXTXCommDriver(foo) Java_gnu_io_RXTXCommDriver_ ## foo #if defined(__sun__) || defined(__hpux__) @@ -4001,7 +4002,7 @@ } /*---------------------------------------------------------- -RXTXCommDriver.nativeGetVersion +RXTXVersion.nativeGetVersion accept: none perform: return the current version @@ -4010,9 +4011,10 @@ comments: This is used to avoid mixing versions of the .jar and native library. First introduced in rxtx-1.5-9 + Moved from RXTXCommDriver to RXTXVersion in rxtx-2.1-7 ----------------------------------------------------------*/ -JNIEXPORT jstring JNICALL RXTXCommDriver(nativeGetVersion) (JNIEnv *env, +JNIEXPORT jstring JNICALL RXTXVersion(nativeGetVersion) (JNIEnv *env, jclass jclazz ) { return (*env)->NewStringUTF( env, "RXTX-2.1-7pre20" ); From ricardo.trindade at emation.pt Thu Apr 7 03:45:58 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 10:45:58 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: <42550156.2040908@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050407/05212451/attachment-0010.html From thomas.shulok at lmco.com Thu Apr 7 17:43:11 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Thu, 07 Apr 2005 19:43:11 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi There, I'm attempting to talk RS232 between an embedded Linux box and a Windows box. Everything connects up fine, and I can send and receive a simple sequence of bytes with no problems. However, if around 5 seconds goes by without me sending something, I get the following when I attempt to send. java.io.IOException: Input/output error in writeArray Stack trace: java/lang/Throwable.()V java/lang/Throwable.(Ljava/lang/String;)V java/io/IOException.(Ljava/lang/String;)V gnu/io/RXTXPort.writeArray([BIIZ)V gnu/io/RXTXPort$SerialOutputStream.write([B)V SerialTest.main([Ljava/lang/String;)V If there interval is shorter (say 2 seconds between sends), I have no problems. On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and librxtxSerial-2.0.7pre2.so. Any ideas? Thanks, Thom -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5b23dcf/attachment-0010.html From taj at www.linux.org.uk Thu Apr 7 19:22:36 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:22:36 +0100 (BST) Subject: [Rxtx] Input/output error in writeArray In-Reply-To: References: Message-ID: On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a Windows > box. Everything connects up fine, and I can send and receive a simple > sequence of bytes with no problems. However, if around 5 seconds goes > by without me sending something, I get the following when I attempt to > send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Apr 7 19:24:59 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:24:59 +0100 (BST) Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) Message-ID: hmm. This would not work from applets would it? -- Trent Jarvi taj at www.linux.org.uk ---------- Forwarded message ---------- Date: Thu, 07 Apr 2005 16:05:53 -0400 From: Chris Gaffney To: taj at www.linux.org.uk Subject: RXTX Libraries on Classpath fix Hi, I submitted a patch for RXTX a few weeks ago to allow for loading the native libraries from the classpath. Since sending it to you I found it wasn't working on windows. I've fixed the problem and created a new patch that should replace the older one. The actual change is a one line from a String.equals() to a String.startsWith(). Thanks for a great piece of software, -Chris Gaffney Grand Valley State University -------------- next part -------------- A non-text attachment was scrubbed... Name: libraries_on_classpath_fixed.patch Type: text/x-patch Size: 5617 bytes Desc: Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5d423b8/libraries_on_classpath_fixed-0010.bin From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From thomas.shulok at lmco.com Fri Apr 8 10:38:55 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Fri, 08 Apr 2005 12:38:55 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi Trent, Thanks for the prompt response. Before diving deeper, I was wondering if there is a timeout parameter somewhere in the stack that I have not set properly. Given the nature of the failure (only fails if the line has been idle for a few seconds), it feels like some kind of timeout issue... Thanks again, Thom -----Original Message----- From: rxtx-bounces at mail.linuxgrrls.org [mailto:rxtx-bounces at mail.linuxgrrls.org] On Behalf Of Trent Jarvi Sent: Thursday, April 07, 2005 6:23 PM To: Java RXTX discussion Subject: Re: [Rxtx] Input/output error in writeArray On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a > Windows box. Everything connects up fine, and I can send and receive > a simple sequence of bytes with no problems. However, if around 5 > seconds goes by without me sending something, I get the following when > I attempt to send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at mail.linuxgrrls.org http://mail.linuxgrrls.org/mailman/listinfo/rxtx From ricardo.trindade at emation.pt Mon Apr 4 09:17:23 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Mon, 04 Apr 2005 16:17:23 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot Message-ID: <42515A83.4050907@emation.pt> Hi, I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most recent stable snapshot), and get the following exception : It looks like rxtx has been compiled with jdk 1.5. If this was indeed the case, I think there is a compilation flag that generates code that runs on older jdks. java.lang.UnsupportedClassVersionError: gnu/io/UnsupportedCommOperationException (Unsupported major.minor version 49.0) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at java.net.URLClassLoader.defineClass(URLClassLoader.java:251) at java.net.URLClassLoader.access$100(URLClassLoader.java:55) at java.net.URLClassLoader$1.run(URLClassLoader.java:194) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:187) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:141) I'm trying to run it with 1.4. thanks Ricardo From taj at www.linux.org.uk Tue Apr 5 00:48:12 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 07:48:12 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42515A83.4050907@emation.pt> References: <42515A83.4050907@emation.pt> Message-ID: On Mon, 4 Apr 2005, Ricardo Trindade wrote: > Hi, > > I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most > recent stable snapshot), and get the following exception : > > It looks like rxtx has been compiled with jdk 1.5. If this was > indeed the case, I think there is a compilation flag that generates code > that runs on older jdks. > > java.lang.UnsupportedClassVersionError: > gnu/io/UnsupportedCommOperationException (Unsupported major.minor > version 49.0) [snip] Thanks Ricardo I recompiled the jar with javac -source 1.3 -target 1.3. That should cover most of the JRE's in use today. I also compiled the rxtx 2.0 x86_64 native library which appeared to be missing. I tried looking for flags to pass gcc 4.0 to make the native libraries more backwards compatible but only found options for C++ which is not used in rxtx. I've got a list of other bugs that I'll be going through in the next few weeks but for now I just left them with the same CVS filename - no code changes. ftp://ftp.qbang.org/pub/rxtx/rxtx-2.0-CVS-20050120-bins.tar.gz ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-CVS-20050120-bins.tar.gz -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Tue Apr 5 02:24:33 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 05 Apr 2005 09:24:33 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: References: <42515A83.4050907@emation.pt> Message-ID: <42524B41.3040300@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050405/5919abbb/attachment-0011.html From taj at www.linux.org.uk Tue Apr 5 03:00:29 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 10:00:29 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42524B41.3040300@emation.pt> References: <42515A83.4050907@emation.pt> <42524B41.3040300@emation.pt> Message-ID: On Tue, 5 Apr 2005, Ricardo Trindade wrote: > Will you anounce to the list when a new release is available ? > There will be several incremental releases announced here. Once those are done, we will release 2.1.7 and 2.0.7. -- Trent Jarvi taj at www.linux.org.uk From no_spam at somewhere.com Tue Apr 5 11:55:37 2005 From: no_spam at somewhere.com (no_spam@somewhere.com) Date: Tue, 5 Apr 2005 13:55:37 -0400 Subject: [Rxtx] Closing a port from an event listener results in a deadlock Message-ID: <20050405175537.GA21747@rcog.homelinux.net> On the message I sent on March 14, does anyone had the chance to try the modification? Or was it already fixed? (I haven't searched the archive extensively) Or maybe my message got catched by some spam filters? (it made it to the list archive though) Anyway, I would appreciate some feedback (through the list) Thanks From taj at www.linux.org.uk Tue Apr 5 14:42:28 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 21:42:28 +0100 (BST) Subject: [Rxtx] Closing a port from an event listener results in a deadlock In-Reply-To: <20050405175537.GA21747@rcog.homelinux.net> References: <20050405175537.GA21747@rcog.homelinux.net> Message-ID: On Tue, 5 Apr 2005 no_spam at somewhere.com wrote: > On the message I sent on March 14, does anyone had the chance to try the > modification? > > Or was it already fixed? (I haven't searched the archive extensively) > > Or maybe my message got catched by some spam filters? (it made it to the list > archive though) > > Anyway, I would appreciate some feedback (through the list) > The patch is here http://marc.theaimsgroup.com/?l=rxtx&m=111084488820288&w=2 I have applied this patch to a local copy but will not be doing formal testing for a couple weeks. I do not try to close ports from inside the eventListenter usually so I encourage any feedback also. If there are no problems reported, I expect this will go into rxtx 2.1-7. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Wed Apr 6 08:33:42 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Wed, 06 Apr 2005 15:33:42 +0100 Subject: [Rxtx] getting RXTX version Message-ID: <4253F346.50102@emation.pt> Hi, I want to make sure my deployments have the same version of RXTX jar and native lib. I know the version of the jar can be obtained in the Version class, but how can I obtain the native version ? I know RXTX prints to the console a warning if the version is different. Is there a way to programatically know is this is the case ? I would like to log that to our app's log thanks Ricardo From taj at www.linux.org.uk Wed Apr 6 15:10:20 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 6 Apr 2005 22:10:20 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4253F346.50102@emation.pt> References: <4253F346.50102@emation.pt> Message-ID: On Wed, 6 Apr 2005, Ricardo Trindade wrote: > Hi, > > I want to make sure my deployments have the same version of RXTX jar > and native lib. > > I know the version of the jar can be obtained in the Version class, > but how can I obtain the native version ? > > I know RXTX prints to the console a warning if the version is > different. Is there a way to programatically know is this is the case ? > > I would like to log that to our app's log > There isn't a suggested way of doing that right now. We could move things around and have a static String RXTXVersion.getNativeVersion() in future releases. Is this what you expected? This is not documented in commapi at all. I just tossed that in to catch conflicts while developing. It would be nice to have access in GUI applications though. It may be possible to access RXTXCommDriver.LibVersion right now. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Thu Apr 7 02:51:00 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 09:51:00 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> Message-ID: <4254F474.7020905@emation.pt> >There isn't a suggested way of doing that right now. We could move things >around and have a static String RXTXVersion.getNativeVersion() in future >releases. Is this what you expected? > > Yes, that would be perfect. >This is not documented in commapi at all. I just tossed that in to catch >conflicts while developing. It would be nice to have access in GUI >applications though. > >It may be possible to access RXTXCommDriver.LibVersion right now. > > > I tried, and I don't think it's possible. From taj at www.linux.org.uk Thu Apr 7 03:32:04 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 7 Apr 2005 10:32:04 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4254F474.7020905@emation.pt> References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: On Thu, 7 Apr 2005, Ricardo Trindade wrote: > > >There isn't a suggested way of doing that right now. We could move things > >around and have a static String RXTXVersion.getNativeVersion() in future > >releases. Is this what you expected? > > > > > > Yes, that would be perfect. > The attached should do what you want. You will still need to catch an exception for older versions... -- Trent Jarvi taj at www.linux.org.uk -------------- next part -------------- ? public_version.patch Index: RXTXCommDriver.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXCommDriver.java,v retrieving revision 1.16.2.51 diff -u -r1.16.2.51 RXTXCommDriver.java --- RXTXCommDriver.java 12 Oct 2004 09:13:30 -0000 1.16.2.51 +++ RXTXCommDriver.java 7 Apr 2005 09:29:04 -0000 @@ -54,7 +54,7 @@ the Library. */ String JarVersion = RXTXVersion.getVersion(); - String LibVersion = nativeGetVersion(); + String LibVersion = RXTXVersion.nativeGetVersion(); if ( devel ) { System.out.println("Devel Library"); @@ -76,7 +76,6 @@ /** Get the Serial port prefixes for the running OS */ private String deviceDirectory; private String osName; - private static native String nativeGetVersion(); private native boolean registerKnownPorts(int PortType); private native boolean isPortPrefixValid(String dev); private native boolean testRead(String dev, int type); Index: RXTXVersion.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXVersion.java,v retrieving revision 1.2.2.31 diff -u -r1.2.2.31 RXTXVersion.java --- RXTXVersion.java 16 Oct 2004 16:20:35 -0000 1.2.2.31 +++ RXTXVersion.java 7 Apr 2005 09:29:04 -0000 @@ -36,6 +36,7 @@ private static String Version; static { + System.loadLibrary( "rxtxSerial" ); Version = "RXTX-2.1-7pre20"; } /** @@ -47,4 +48,5 @@ { return(Version); } + public static native String nativeGetVersion(); } Index: SerialImp.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v retrieving revision 1.46.2.181 diff -u -r1.46.2.181 SerialImp.c --- SerialImp.c 17 Oct 2004 09:48:56 -0000 1.46.2.181 +++ SerialImp.c 7 Apr 2005 09:29:07 -0000 @@ -116,6 +116,7 @@ * It will eventually be removed. * */ #define RXTXPort(foo) Java_gnu_io_RXTXPort_ ## foo +#define RXTXVersion(foo) Java_gnu_io_RXTXVersion_ ## foo #define RXTXCommDriver(foo) Java_gnu_io_RXTXCommDriver_ ## foo #if defined(__sun__) || defined(__hpux__) @@ -4001,7 +4002,7 @@ } /*---------------------------------------------------------- -RXTXCommDriver.nativeGetVersion +RXTXVersion.nativeGetVersion accept: none perform: return the current version @@ -4010,9 +4011,10 @@ comments: This is used to avoid mixing versions of the .jar and native library. First introduced in rxtx-1.5-9 + Moved from RXTXCommDriver to RXTXVersion in rxtx-2.1-7 ----------------------------------------------------------*/ -JNIEXPORT jstring JNICALL RXTXCommDriver(nativeGetVersion) (JNIEnv *env, +JNIEXPORT jstring JNICALL RXTXVersion(nativeGetVersion) (JNIEnv *env, jclass jclazz ) { return (*env)->NewStringUTF( env, "RXTX-2.1-7pre20" ); From ricardo.trindade at emation.pt Thu Apr 7 03:45:58 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 10:45:58 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: <42550156.2040908@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050407/05212451/attachment-0011.html From thomas.shulok at lmco.com Thu Apr 7 17:43:11 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Thu, 07 Apr 2005 19:43:11 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi There, I'm attempting to talk RS232 between an embedded Linux box and a Windows box. Everything connects up fine, and I can send and receive a simple sequence of bytes with no problems. However, if around 5 seconds goes by without me sending something, I get the following when I attempt to send. java.io.IOException: Input/output error in writeArray Stack trace: java/lang/Throwable.()V java/lang/Throwable.(Ljava/lang/String;)V java/io/IOException.(Ljava/lang/String;)V gnu/io/RXTXPort.writeArray([BIIZ)V gnu/io/RXTXPort$SerialOutputStream.write([B)V SerialTest.main([Ljava/lang/String;)V If there interval is shorter (say 2 seconds between sends), I have no problems. On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and librxtxSerial-2.0.7pre2.so. Any ideas? Thanks, Thom -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5b23dcf/attachment-0011.html From taj at www.linux.org.uk Thu Apr 7 19:22:36 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:22:36 +0100 (BST) Subject: [Rxtx] Input/output error in writeArray In-Reply-To: References: Message-ID: On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a Windows > box. Everything connects up fine, and I can send and receive a simple > sequence of bytes with no problems. However, if around 5 seconds goes > by without me sending something, I get the following when I attempt to > send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Apr 7 19:24:59 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:24:59 +0100 (BST) Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) Message-ID: hmm. This would not work from applets would it? -- Trent Jarvi taj at www.linux.org.uk ---------- Forwarded message ---------- Date: Thu, 07 Apr 2005 16:05:53 -0400 From: Chris Gaffney To: taj at www.linux.org.uk Subject: RXTX Libraries on Classpath fix Hi, I submitted a patch for RXTX a few weeks ago to allow for loading the native libraries from the classpath. Since sending it to you I found it wasn't working on windows. I've fixed the problem and created a new patch that should replace the older one. The actual change is a one line from a String.equals() to a String.startsWith(). Thanks for a great piece of software, -Chris Gaffney Grand Valley State University -------------- next part -------------- A non-text attachment was scrubbed... Name: libraries_on_classpath_fixed.patch Type: text/x-patch Size: 5617 bytes Desc: Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5d423b8/libraries_on_classpath_fixed-0011.bin From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From thomas.shulok at lmco.com Fri Apr 8 10:38:55 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Fri, 08 Apr 2005 12:38:55 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi Trent, Thanks for the prompt response. Before diving deeper, I was wondering if there is a timeout parameter somewhere in the stack that I have not set properly. Given the nature of the failure (only fails if the line has been idle for a few seconds), it feels like some kind of timeout issue... Thanks again, Thom -----Original Message----- From: rxtx-bounces at mail.linuxgrrls.org [mailto:rxtx-bounces at mail.linuxgrrls.org] On Behalf Of Trent Jarvi Sent: Thursday, April 07, 2005 6:23 PM To: Java RXTX discussion Subject: Re: [Rxtx] Input/output error in writeArray On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a > Windows box. Everything connects up fine, and I can send and receive > a simple sequence of bytes with no problems. However, if around 5 > seconds goes by without me sending something, I get the following when > I attempt to send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at mail.linuxgrrls.org http://mail.linuxgrrls.org/mailman/listinfo/rxtx From ricardo.trindade at emation.pt Mon Apr 4 09:17:23 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Mon, 04 Apr 2005 16:17:23 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot Message-ID: <42515A83.4050907@emation.pt> Hi, I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most recent stable snapshot), and get the following exception : It looks like rxtx has been compiled with jdk 1.5. If this was indeed the case, I think there is a compilation flag that generates code that runs on older jdks. java.lang.UnsupportedClassVersionError: gnu/io/UnsupportedCommOperationException (Unsupported major.minor version 49.0) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at java.net.URLClassLoader.defineClass(URLClassLoader.java:251) at java.net.URLClassLoader.access$100(URLClassLoader.java:55) at java.net.URLClassLoader$1.run(URLClassLoader.java:194) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:187) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:141) I'm trying to run it with 1.4. thanks Ricardo From taj at www.linux.org.uk Tue Apr 5 00:48:12 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 07:48:12 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42515A83.4050907@emation.pt> References: <42515A83.4050907@emation.pt> Message-ID: On Mon, 4 Apr 2005, Ricardo Trindade wrote: > Hi, > > I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most > recent stable snapshot), and get the following exception : > > It looks like rxtx has been compiled with jdk 1.5. If this was > indeed the case, I think there is a compilation flag that generates code > that runs on older jdks. > > java.lang.UnsupportedClassVersionError: > gnu/io/UnsupportedCommOperationException (Unsupported major.minor > version 49.0) [snip] Thanks Ricardo I recompiled the jar with javac -source 1.3 -target 1.3. That should cover most of the JRE's in use today. I also compiled the rxtx 2.0 x86_64 native library which appeared to be missing. I tried looking for flags to pass gcc 4.0 to make the native libraries more backwards compatible but only found options for C++ which is not used in rxtx. I've got a list of other bugs that I'll be going through in the next few weeks but for now I just left them with the same CVS filename - no code changes. ftp://ftp.qbang.org/pub/rxtx/rxtx-2.0-CVS-20050120-bins.tar.gz ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-CVS-20050120-bins.tar.gz -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Tue Apr 5 02:24:33 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 05 Apr 2005 09:24:33 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: References: <42515A83.4050907@emation.pt> Message-ID: <42524B41.3040300@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050405/5919abbb/attachment-0012.html From taj at www.linux.org.uk Tue Apr 5 03:00:29 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 10:00:29 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42524B41.3040300@emation.pt> References: <42515A83.4050907@emation.pt> <42524B41.3040300@emation.pt> Message-ID: On Tue, 5 Apr 2005, Ricardo Trindade wrote: > Will you anounce to the list when a new release is available ? > There will be several incremental releases announced here. Once those are done, we will release 2.1.7 and 2.0.7. -- Trent Jarvi taj at www.linux.org.uk From no_spam at somewhere.com Tue Apr 5 11:55:37 2005 From: no_spam at somewhere.com (no_spam@somewhere.com) Date: Tue, 5 Apr 2005 13:55:37 -0400 Subject: [Rxtx] Closing a port from an event listener results in a deadlock Message-ID: <20050405175537.GA21747@rcog.homelinux.net> On the message I sent on March 14, does anyone had the chance to try the modification? Or was it already fixed? (I haven't searched the archive extensively) Or maybe my message got catched by some spam filters? (it made it to the list archive though) Anyway, I would appreciate some feedback (through the list) Thanks From taj at www.linux.org.uk Tue Apr 5 14:42:28 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 21:42:28 +0100 (BST) Subject: [Rxtx] Closing a port from an event listener results in a deadlock In-Reply-To: <20050405175537.GA21747@rcog.homelinux.net> References: <20050405175537.GA21747@rcog.homelinux.net> Message-ID: On Tue, 5 Apr 2005 no_spam at somewhere.com wrote: > On the message I sent on March 14, does anyone had the chance to try the > modification? > > Or was it already fixed? (I haven't searched the archive extensively) > > Or maybe my message got catched by some spam filters? (it made it to the list > archive though) > > Anyway, I would appreciate some feedback (through the list) > The patch is here http://marc.theaimsgroup.com/?l=rxtx&m=111084488820288&w=2 I have applied this patch to a local copy but will not be doing formal testing for a couple weeks. I do not try to close ports from inside the eventListenter usually so I encourage any feedback also. If there are no problems reported, I expect this will go into rxtx 2.1-7. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Wed Apr 6 08:33:42 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Wed, 06 Apr 2005 15:33:42 +0100 Subject: [Rxtx] getting RXTX version Message-ID: <4253F346.50102@emation.pt> Hi, I want to make sure my deployments have the same version of RXTX jar and native lib. I know the version of the jar can be obtained in the Version class, but how can I obtain the native version ? I know RXTX prints to the console a warning if the version is different. Is there a way to programatically know is this is the case ? I would like to log that to our app's log thanks Ricardo From taj at www.linux.org.uk Wed Apr 6 15:10:20 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 6 Apr 2005 22:10:20 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4253F346.50102@emation.pt> References: <4253F346.50102@emation.pt> Message-ID: On Wed, 6 Apr 2005, Ricardo Trindade wrote: > Hi, > > I want to make sure my deployments have the same version of RXTX jar > and native lib. > > I know the version of the jar can be obtained in the Version class, > but how can I obtain the native version ? > > I know RXTX prints to the console a warning if the version is > different. Is there a way to programatically know is this is the case ? > > I would like to log that to our app's log > There isn't a suggested way of doing that right now. We could move things around and have a static String RXTXVersion.getNativeVersion() in future releases. Is this what you expected? This is not documented in commapi at all. I just tossed that in to catch conflicts while developing. It would be nice to have access in GUI applications though. It may be possible to access RXTXCommDriver.LibVersion right now. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Thu Apr 7 02:51:00 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 09:51:00 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> Message-ID: <4254F474.7020905@emation.pt> >There isn't a suggested way of doing that right now. We could move things >around and have a static String RXTXVersion.getNativeVersion() in future >releases. Is this what you expected? > > Yes, that would be perfect. >This is not documented in commapi at all. I just tossed that in to catch >conflicts while developing. It would be nice to have access in GUI >applications though. > >It may be possible to access RXTXCommDriver.LibVersion right now. > > > I tried, and I don't think it's possible. From taj at www.linux.org.uk Thu Apr 7 03:32:04 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 7 Apr 2005 10:32:04 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4254F474.7020905@emation.pt> References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: On Thu, 7 Apr 2005, Ricardo Trindade wrote: > > >There isn't a suggested way of doing that right now. We could move things > >around and have a static String RXTXVersion.getNativeVersion() in future > >releases. Is this what you expected? > > > > > > Yes, that would be perfect. > The attached should do what you want. You will still need to catch an exception for older versions... -- Trent Jarvi taj at www.linux.org.uk -------------- next part -------------- ? public_version.patch Index: RXTXCommDriver.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXCommDriver.java,v retrieving revision 1.16.2.51 diff -u -r1.16.2.51 RXTXCommDriver.java --- RXTXCommDriver.java 12 Oct 2004 09:13:30 -0000 1.16.2.51 +++ RXTXCommDriver.java 7 Apr 2005 09:29:04 -0000 @@ -54,7 +54,7 @@ the Library. */ String JarVersion = RXTXVersion.getVersion(); - String LibVersion = nativeGetVersion(); + String LibVersion = RXTXVersion.nativeGetVersion(); if ( devel ) { System.out.println("Devel Library"); @@ -76,7 +76,6 @@ /** Get the Serial port prefixes for the running OS */ private String deviceDirectory; private String osName; - private static native String nativeGetVersion(); private native boolean registerKnownPorts(int PortType); private native boolean isPortPrefixValid(String dev); private native boolean testRead(String dev, int type); Index: RXTXVersion.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXVersion.java,v retrieving revision 1.2.2.31 diff -u -r1.2.2.31 RXTXVersion.java --- RXTXVersion.java 16 Oct 2004 16:20:35 -0000 1.2.2.31 +++ RXTXVersion.java 7 Apr 2005 09:29:04 -0000 @@ -36,6 +36,7 @@ private static String Version; static { + System.loadLibrary( "rxtxSerial" ); Version = "RXTX-2.1-7pre20"; } /** @@ -47,4 +48,5 @@ { return(Version); } + public static native String nativeGetVersion(); } Index: SerialImp.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v retrieving revision 1.46.2.181 diff -u -r1.46.2.181 SerialImp.c --- SerialImp.c 17 Oct 2004 09:48:56 -0000 1.46.2.181 +++ SerialImp.c 7 Apr 2005 09:29:07 -0000 @@ -116,6 +116,7 @@ * It will eventually be removed. * */ #define RXTXPort(foo) Java_gnu_io_RXTXPort_ ## foo +#define RXTXVersion(foo) Java_gnu_io_RXTXVersion_ ## foo #define RXTXCommDriver(foo) Java_gnu_io_RXTXCommDriver_ ## foo #if defined(__sun__) || defined(__hpux__) @@ -4001,7 +4002,7 @@ } /*---------------------------------------------------------- -RXTXCommDriver.nativeGetVersion +RXTXVersion.nativeGetVersion accept: none perform: return the current version @@ -4010,9 +4011,10 @@ comments: This is used to avoid mixing versions of the .jar and native library. First introduced in rxtx-1.5-9 + Moved from RXTXCommDriver to RXTXVersion in rxtx-2.1-7 ----------------------------------------------------------*/ -JNIEXPORT jstring JNICALL RXTXCommDriver(nativeGetVersion) (JNIEnv *env, +JNIEXPORT jstring JNICALL RXTXVersion(nativeGetVersion) (JNIEnv *env, jclass jclazz ) { return (*env)->NewStringUTF( env, "RXTX-2.1-7pre20" ); From ricardo.trindade at emation.pt Thu Apr 7 03:45:58 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 10:45:58 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: <42550156.2040908@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050407/05212451/attachment-0012.html From thomas.shulok at lmco.com Thu Apr 7 17:43:11 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Thu, 07 Apr 2005 19:43:11 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi There, I'm attempting to talk RS232 between an embedded Linux box and a Windows box. Everything connects up fine, and I can send and receive a simple sequence of bytes with no problems. However, if around 5 seconds goes by without me sending something, I get the following when I attempt to send. java.io.IOException: Input/output error in writeArray Stack trace: java/lang/Throwable.()V java/lang/Throwable.(Ljava/lang/String;)V java/io/IOException.(Ljava/lang/String;)V gnu/io/RXTXPort.writeArray([BIIZ)V gnu/io/RXTXPort$SerialOutputStream.write([B)V SerialTest.main([Ljava/lang/String;)V If there interval is shorter (say 2 seconds between sends), I have no problems. On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and librxtxSerial-2.0.7pre2.so. Any ideas? Thanks, Thom -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5b23dcf/attachment-0012.html From taj at www.linux.org.uk Thu Apr 7 19:22:36 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:22:36 +0100 (BST) Subject: [Rxtx] Input/output error in writeArray In-Reply-To: References: Message-ID: On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a Windows > box. Everything connects up fine, and I can send and receive a simple > sequence of bytes with no problems. However, if around 5 seconds goes > by without me sending something, I get the following when I attempt to > send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Apr 7 19:24:59 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:24:59 +0100 (BST) Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) Message-ID: hmm. This would not work from applets would it? -- Trent Jarvi taj at www.linux.org.uk ---------- Forwarded message ---------- Date: Thu, 07 Apr 2005 16:05:53 -0400 From: Chris Gaffney To: taj at www.linux.org.uk Subject: RXTX Libraries on Classpath fix Hi, I submitted a patch for RXTX a few weeks ago to allow for loading the native libraries from the classpath. Since sending it to you I found it wasn't working on windows. I've fixed the problem and created a new patch that should replace the older one. The actual change is a one line from a String.equals() to a String.startsWith(). Thanks for a great piece of software, -Chris Gaffney Grand Valley State University -------------- next part -------------- A non-text attachment was scrubbed... Name: libraries_on_classpath_fixed.patch Type: text/x-patch Size: 5617 bytes Desc: Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5d423b8/libraries_on_classpath_fixed-0012.bin From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From thomas.shulok at lmco.com Fri Apr 8 10:38:55 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Fri, 08 Apr 2005 12:38:55 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi Trent, Thanks for the prompt response. Before diving deeper, I was wondering if there is a timeout parameter somewhere in the stack that I have not set properly. Given the nature of the failure (only fails if the line has been idle for a few seconds), it feels like some kind of timeout issue... Thanks again, Thom -----Original Message----- From: rxtx-bounces at mail.linuxgrrls.org [mailto:rxtx-bounces at mail.linuxgrrls.org] On Behalf Of Trent Jarvi Sent: Thursday, April 07, 2005 6:23 PM To: Java RXTX discussion Subject: Re: [Rxtx] Input/output error in writeArray On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a > Windows box. Everything connects up fine, and I can send and receive > a simple sequence of bytes with no problems. However, if around 5 > seconds goes by without me sending something, I get the following when > I attempt to send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at mail.linuxgrrls.org http://mail.linuxgrrls.org/mailman/listinfo/rxtx From ricardo.trindade at emation.pt Mon Apr 4 09:17:23 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Mon, 04 Apr 2005 16:17:23 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot Message-ID: <42515A83.4050907@emation.pt> Hi, I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most recent stable snapshot), and get the following exception : It looks like rxtx has been compiled with jdk 1.5. If this was indeed the case, I think there is a compilation flag that generates code that runs on older jdks. java.lang.UnsupportedClassVersionError: gnu/io/UnsupportedCommOperationException (Unsupported major.minor version 49.0) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at java.net.URLClassLoader.defineClass(URLClassLoader.java:251) at java.net.URLClassLoader.access$100(URLClassLoader.java:55) at java.net.URLClassLoader$1.run(URLClassLoader.java:194) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:187) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:141) I'm trying to run it with 1.4. thanks Ricardo From taj at www.linux.org.uk Tue Apr 5 00:48:12 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 07:48:12 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42515A83.4050907@emation.pt> References: <42515A83.4050907@emation.pt> Message-ID: On Mon, 4 Apr 2005, Ricardo Trindade wrote: > Hi, > > I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most > recent stable snapshot), and get the following exception : > > It looks like rxtx has been compiled with jdk 1.5. If this was > indeed the case, I think there is a compilation flag that generates code > that runs on older jdks. > > java.lang.UnsupportedClassVersionError: > gnu/io/UnsupportedCommOperationException (Unsupported major.minor > version 49.0) [snip] Thanks Ricardo I recompiled the jar with javac -source 1.3 -target 1.3. That should cover most of the JRE's in use today. I also compiled the rxtx 2.0 x86_64 native library which appeared to be missing. I tried looking for flags to pass gcc 4.0 to make the native libraries more backwards compatible but only found options for C++ which is not used in rxtx. I've got a list of other bugs that I'll be going through in the next few weeks but for now I just left them with the same CVS filename - no code changes. ftp://ftp.qbang.org/pub/rxtx/rxtx-2.0-CVS-20050120-bins.tar.gz ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-CVS-20050120-bins.tar.gz -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Tue Apr 5 02:24:33 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 05 Apr 2005 09:24:33 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: References: <42515A83.4050907@emation.pt> Message-ID: <42524B41.3040300@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050405/5919abbb/attachment-0013.html From taj at www.linux.org.uk Tue Apr 5 03:00:29 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 10:00:29 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42524B41.3040300@emation.pt> References: <42515A83.4050907@emation.pt> <42524B41.3040300@emation.pt> Message-ID: On Tue, 5 Apr 2005, Ricardo Trindade wrote: > Will you anounce to the list when a new release is available ? > There will be several incremental releases announced here. Once those are done, we will release 2.1.7 and 2.0.7. -- Trent Jarvi taj at www.linux.org.uk From no_spam at somewhere.com Tue Apr 5 11:55:37 2005 From: no_spam at somewhere.com (no_spam@somewhere.com) Date: Tue, 5 Apr 2005 13:55:37 -0400 Subject: [Rxtx] Closing a port from an event listener results in a deadlock Message-ID: <20050405175537.GA21747@rcog.homelinux.net> On the message I sent on March 14, does anyone had the chance to try the modification? Or was it already fixed? (I haven't searched the archive extensively) Or maybe my message got catched by some spam filters? (it made it to the list archive though) Anyway, I would appreciate some feedback (through the list) Thanks From taj at www.linux.org.uk Tue Apr 5 14:42:28 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 21:42:28 +0100 (BST) Subject: [Rxtx] Closing a port from an event listener results in a deadlock In-Reply-To: <20050405175537.GA21747@rcog.homelinux.net> References: <20050405175537.GA21747@rcog.homelinux.net> Message-ID: On Tue, 5 Apr 2005 no_spam at somewhere.com wrote: > On the message I sent on March 14, does anyone had the chance to try the > modification? > > Or was it already fixed? (I haven't searched the archive extensively) > > Or maybe my message got catched by some spam filters? (it made it to the list > archive though) > > Anyway, I would appreciate some feedback (through the list) > The patch is here http://marc.theaimsgroup.com/?l=rxtx&m=111084488820288&w=2 I have applied this patch to a local copy but will not be doing formal testing for a couple weeks. I do not try to close ports from inside the eventListenter usually so I encourage any feedback also. If there are no problems reported, I expect this will go into rxtx 2.1-7. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Wed Apr 6 08:33:42 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Wed, 06 Apr 2005 15:33:42 +0100 Subject: [Rxtx] getting RXTX version Message-ID: <4253F346.50102@emation.pt> Hi, I want to make sure my deployments have the same version of RXTX jar and native lib. I know the version of the jar can be obtained in the Version class, but how can I obtain the native version ? I know RXTX prints to the console a warning if the version is different. Is there a way to programatically know is this is the case ? I would like to log that to our app's log thanks Ricardo From taj at www.linux.org.uk Wed Apr 6 15:10:20 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 6 Apr 2005 22:10:20 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4253F346.50102@emation.pt> References: <4253F346.50102@emation.pt> Message-ID: On Wed, 6 Apr 2005, Ricardo Trindade wrote: > Hi, > > I want to make sure my deployments have the same version of RXTX jar > and native lib. > > I know the version of the jar can be obtained in the Version class, > but how can I obtain the native version ? > > I know RXTX prints to the console a warning if the version is > different. Is there a way to programatically know is this is the case ? > > I would like to log that to our app's log > There isn't a suggested way of doing that right now. We could move things around and have a static String RXTXVersion.getNativeVersion() in future releases. Is this what you expected? This is not documented in commapi at all. I just tossed that in to catch conflicts while developing. It would be nice to have access in GUI applications though. It may be possible to access RXTXCommDriver.LibVersion right now. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Thu Apr 7 02:51:00 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 09:51:00 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> Message-ID: <4254F474.7020905@emation.pt> >There isn't a suggested way of doing that right now. We could move things >around and have a static String RXTXVersion.getNativeVersion() in future >releases. Is this what you expected? > > Yes, that would be perfect. >This is not documented in commapi at all. I just tossed that in to catch >conflicts while developing. It would be nice to have access in GUI >applications though. > >It may be possible to access RXTXCommDriver.LibVersion right now. > > > I tried, and I don't think it's possible. From taj at www.linux.org.uk Thu Apr 7 03:32:04 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 7 Apr 2005 10:32:04 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4254F474.7020905@emation.pt> References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: On Thu, 7 Apr 2005, Ricardo Trindade wrote: > > >There isn't a suggested way of doing that right now. We could move things > >around and have a static String RXTXVersion.getNativeVersion() in future > >releases. Is this what you expected? > > > > > > Yes, that would be perfect. > The attached should do what you want. You will still need to catch an exception for older versions... -- Trent Jarvi taj at www.linux.org.uk -------------- next part -------------- ? public_version.patch Index: RXTXCommDriver.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXCommDriver.java,v retrieving revision 1.16.2.51 diff -u -r1.16.2.51 RXTXCommDriver.java --- RXTXCommDriver.java 12 Oct 2004 09:13:30 -0000 1.16.2.51 +++ RXTXCommDriver.java 7 Apr 2005 09:29:04 -0000 @@ -54,7 +54,7 @@ the Library. */ String JarVersion = RXTXVersion.getVersion(); - String LibVersion = nativeGetVersion(); + String LibVersion = RXTXVersion.nativeGetVersion(); if ( devel ) { System.out.println("Devel Library"); @@ -76,7 +76,6 @@ /** Get the Serial port prefixes for the running OS */ private String deviceDirectory; private String osName; - private static native String nativeGetVersion(); private native boolean registerKnownPorts(int PortType); private native boolean isPortPrefixValid(String dev); private native boolean testRead(String dev, int type); Index: RXTXVersion.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXVersion.java,v retrieving revision 1.2.2.31 diff -u -r1.2.2.31 RXTXVersion.java --- RXTXVersion.java 16 Oct 2004 16:20:35 -0000 1.2.2.31 +++ RXTXVersion.java 7 Apr 2005 09:29:04 -0000 @@ -36,6 +36,7 @@ private static String Version; static { + System.loadLibrary( "rxtxSerial" ); Version = "RXTX-2.1-7pre20"; } /** @@ -47,4 +48,5 @@ { return(Version); } + public static native String nativeGetVersion(); } Index: SerialImp.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v retrieving revision 1.46.2.181 diff -u -r1.46.2.181 SerialImp.c --- SerialImp.c 17 Oct 2004 09:48:56 -0000 1.46.2.181 +++ SerialImp.c 7 Apr 2005 09:29:07 -0000 @@ -116,6 +116,7 @@ * It will eventually be removed. * */ #define RXTXPort(foo) Java_gnu_io_RXTXPort_ ## foo +#define RXTXVersion(foo) Java_gnu_io_RXTXVersion_ ## foo #define RXTXCommDriver(foo) Java_gnu_io_RXTXCommDriver_ ## foo #if defined(__sun__) || defined(__hpux__) @@ -4001,7 +4002,7 @@ } /*---------------------------------------------------------- -RXTXCommDriver.nativeGetVersion +RXTXVersion.nativeGetVersion accept: none perform: return the current version @@ -4010,9 +4011,10 @@ comments: This is used to avoid mixing versions of the .jar and native library. First introduced in rxtx-1.5-9 + Moved from RXTXCommDriver to RXTXVersion in rxtx-2.1-7 ----------------------------------------------------------*/ -JNIEXPORT jstring JNICALL RXTXCommDriver(nativeGetVersion) (JNIEnv *env, +JNIEXPORT jstring JNICALL RXTXVersion(nativeGetVersion) (JNIEnv *env, jclass jclazz ) { return (*env)->NewStringUTF( env, "RXTX-2.1-7pre20" ); From ricardo.trindade at emation.pt Thu Apr 7 03:45:58 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 10:45:58 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: <42550156.2040908@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050407/05212451/attachment-0013.html From thomas.shulok at lmco.com Thu Apr 7 17:43:11 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Thu, 07 Apr 2005 19:43:11 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi There, I'm attempting to talk RS232 between an embedded Linux box and a Windows box. Everything connects up fine, and I can send and receive a simple sequence of bytes with no problems. However, if around 5 seconds goes by without me sending something, I get the following when I attempt to send. java.io.IOException: Input/output error in writeArray Stack trace: java/lang/Throwable.()V java/lang/Throwable.(Ljava/lang/String;)V java/io/IOException.(Ljava/lang/String;)V gnu/io/RXTXPort.writeArray([BIIZ)V gnu/io/RXTXPort$SerialOutputStream.write([B)V SerialTest.main([Ljava/lang/String;)V If there interval is shorter (say 2 seconds between sends), I have no problems. On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and librxtxSerial-2.0.7pre2.so. Any ideas? Thanks, Thom -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5b23dcf/attachment-0013.html From taj at www.linux.org.uk Thu Apr 7 19:22:36 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:22:36 +0100 (BST) Subject: [Rxtx] Input/output error in writeArray In-Reply-To: References: Message-ID: On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a Windows > box. Everything connects up fine, and I can send and receive a simple > sequence of bytes with no problems. However, if around 5 seconds goes > by without me sending something, I get the following when I attempt to > send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Apr 7 19:24:59 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:24:59 +0100 (BST) Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) Message-ID: hmm. This would not work from applets would it? -- Trent Jarvi taj at www.linux.org.uk ---------- Forwarded message ---------- Date: Thu, 07 Apr 2005 16:05:53 -0400 From: Chris Gaffney To: taj at www.linux.org.uk Subject: RXTX Libraries on Classpath fix Hi, I submitted a patch for RXTX a few weeks ago to allow for loading the native libraries from the classpath. Since sending it to you I found it wasn't working on windows. I've fixed the problem and created a new patch that should replace the older one. The actual change is a one line from a String.equals() to a String.startsWith(). Thanks for a great piece of software, -Chris Gaffney Grand Valley State University -------------- next part -------------- A non-text attachment was scrubbed... Name: libraries_on_classpath_fixed.patch Type: text/x-patch Size: 5617 bytes Desc: Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5d423b8/libraries_on_classpath_fixed-0013.bin From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From thomas.shulok at lmco.com Fri Apr 8 10:38:55 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Fri, 08 Apr 2005 12:38:55 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi Trent, Thanks for the prompt response. Before diving deeper, I was wondering if there is a timeout parameter somewhere in the stack that I have not set properly. Given the nature of the failure (only fails if the line has been idle for a few seconds), it feels like some kind of timeout issue... Thanks again, Thom -----Original Message----- From: rxtx-bounces at mail.linuxgrrls.org [mailto:rxtx-bounces at mail.linuxgrrls.org] On Behalf Of Trent Jarvi Sent: Thursday, April 07, 2005 6:23 PM To: Java RXTX discussion Subject: Re: [Rxtx] Input/output error in writeArray On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a > Windows box. Everything connects up fine, and I can send and receive > a simple sequence of bytes with no problems. However, if around 5 > seconds goes by without me sending something, I get the following when > I attempt to send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at mail.linuxgrrls.org http://mail.linuxgrrls.org/mailman/listinfo/rxtx From ricardo.trindade at emation.pt Mon Apr 4 09:17:23 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Mon, 04 Apr 2005 16:17:23 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot Message-ID: <42515A83.4050907@emation.pt> Hi, I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most recent stable snapshot), and get the following exception : It looks like rxtx has been compiled with jdk 1.5. If this was indeed the case, I think there is a compilation flag that generates code that runs on older jdks. java.lang.UnsupportedClassVersionError: gnu/io/UnsupportedCommOperationException (Unsupported major.minor version 49.0) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at java.net.URLClassLoader.defineClass(URLClassLoader.java:251) at java.net.URLClassLoader.access$100(URLClassLoader.java:55) at java.net.URLClassLoader$1.run(URLClassLoader.java:194) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:187) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:141) I'm trying to run it with 1.4. thanks Ricardo From taj at www.linux.org.uk Tue Apr 5 00:48:12 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 07:48:12 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42515A83.4050907@emation.pt> References: <42515A83.4050907@emation.pt> Message-ID: On Mon, 4 Apr 2005, Ricardo Trindade wrote: > Hi, > > I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most > recent stable snapshot), and get the following exception : > > It looks like rxtx has been compiled with jdk 1.5. If this was > indeed the case, I think there is a compilation flag that generates code > that runs on older jdks. > > java.lang.UnsupportedClassVersionError: > gnu/io/UnsupportedCommOperationException (Unsupported major.minor > version 49.0) [snip] Thanks Ricardo I recompiled the jar with javac -source 1.3 -target 1.3. That should cover most of the JRE's in use today. I also compiled the rxtx 2.0 x86_64 native library which appeared to be missing. I tried looking for flags to pass gcc 4.0 to make the native libraries more backwards compatible but only found options for C++ which is not used in rxtx. I've got a list of other bugs that I'll be going through in the next few weeks but for now I just left them with the same CVS filename - no code changes. ftp://ftp.qbang.org/pub/rxtx/rxtx-2.0-CVS-20050120-bins.tar.gz ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-CVS-20050120-bins.tar.gz -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Tue Apr 5 02:24:33 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 05 Apr 2005 09:24:33 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: References: <42515A83.4050907@emation.pt> Message-ID: <42524B41.3040300@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050405/5919abbb/attachment-0014.html From taj at www.linux.org.uk Tue Apr 5 03:00:29 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 10:00:29 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42524B41.3040300@emation.pt> References: <42515A83.4050907@emation.pt> <42524B41.3040300@emation.pt> Message-ID: On Tue, 5 Apr 2005, Ricardo Trindade wrote: > Will you anounce to the list when a new release is available ? > There will be several incremental releases announced here. Once those are done, we will release 2.1.7 and 2.0.7. -- Trent Jarvi taj at www.linux.org.uk From no_spam at somewhere.com Tue Apr 5 11:55:37 2005 From: no_spam at somewhere.com (no_spam@somewhere.com) Date: Tue, 5 Apr 2005 13:55:37 -0400 Subject: [Rxtx] Closing a port from an event listener results in a deadlock Message-ID: <20050405175537.GA21747@rcog.homelinux.net> On the message I sent on March 14, does anyone had the chance to try the modification? Or was it already fixed? (I haven't searched the archive extensively) Or maybe my message got catched by some spam filters? (it made it to the list archive though) Anyway, I would appreciate some feedback (through the list) Thanks From taj at www.linux.org.uk Tue Apr 5 14:42:28 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 21:42:28 +0100 (BST) Subject: [Rxtx] Closing a port from an event listener results in a deadlock In-Reply-To: <20050405175537.GA21747@rcog.homelinux.net> References: <20050405175537.GA21747@rcog.homelinux.net> Message-ID: On Tue, 5 Apr 2005 no_spam at somewhere.com wrote: > On the message I sent on March 14, does anyone had the chance to try the > modification? > > Or was it already fixed? (I haven't searched the archive extensively) > > Or maybe my message got catched by some spam filters? (it made it to the list > archive though) > > Anyway, I would appreciate some feedback (through the list) > The patch is here http://marc.theaimsgroup.com/?l=rxtx&m=111084488820288&w=2 I have applied this patch to a local copy but will not be doing formal testing for a couple weeks. I do not try to close ports from inside the eventListenter usually so I encourage any feedback also. If there are no problems reported, I expect this will go into rxtx 2.1-7. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Wed Apr 6 08:33:42 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Wed, 06 Apr 2005 15:33:42 +0100 Subject: [Rxtx] getting RXTX version Message-ID: <4253F346.50102@emation.pt> Hi, I want to make sure my deployments have the same version of RXTX jar and native lib. I know the version of the jar can be obtained in the Version class, but how can I obtain the native version ? I know RXTX prints to the console a warning if the version is different. Is there a way to programatically know is this is the case ? I would like to log that to our app's log thanks Ricardo From taj at www.linux.org.uk Wed Apr 6 15:10:20 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 6 Apr 2005 22:10:20 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4253F346.50102@emation.pt> References: <4253F346.50102@emation.pt> Message-ID: On Wed, 6 Apr 2005, Ricardo Trindade wrote: > Hi, > > I want to make sure my deployments have the same version of RXTX jar > and native lib. > > I know the version of the jar can be obtained in the Version class, > but how can I obtain the native version ? > > I know RXTX prints to the console a warning if the version is > different. Is there a way to programatically know is this is the case ? > > I would like to log that to our app's log > There isn't a suggested way of doing that right now. We could move things around and have a static String RXTXVersion.getNativeVersion() in future releases. Is this what you expected? This is not documented in commapi at all. I just tossed that in to catch conflicts while developing. It would be nice to have access in GUI applications though. It may be possible to access RXTXCommDriver.LibVersion right now. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Thu Apr 7 02:51:00 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 09:51:00 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> Message-ID: <4254F474.7020905@emation.pt> >There isn't a suggested way of doing that right now. We could move things >around and have a static String RXTXVersion.getNativeVersion() in future >releases. Is this what you expected? > > Yes, that would be perfect. >This is not documented in commapi at all. I just tossed that in to catch >conflicts while developing. It would be nice to have access in GUI >applications though. > >It may be possible to access RXTXCommDriver.LibVersion right now. > > > I tried, and I don't think it's possible. From taj at www.linux.org.uk Thu Apr 7 03:32:04 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 7 Apr 2005 10:32:04 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4254F474.7020905@emation.pt> References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: On Thu, 7 Apr 2005, Ricardo Trindade wrote: > > >There isn't a suggested way of doing that right now. We could move things > >around and have a static String RXTXVersion.getNativeVersion() in future > >releases. Is this what you expected? > > > > > > Yes, that would be perfect. > The attached should do what you want. You will still need to catch an exception for older versions... -- Trent Jarvi taj at www.linux.org.uk -------------- next part -------------- ? public_version.patch Index: RXTXCommDriver.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXCommDriver.java,v retrieving revision 1.16.2.51 diff -u -r1.16.2.51 RXTXCommDriver.java --- RXTXCommDriver.java 12 Oct 2004 09:13:30 -0000 1.16.2.51 +++ RXTXCommDriver.java 7 Apr 2005 09:29:04 -0000 @@ -54,7 +54,7 @@ the Library. */ String JarVersion = RXTXVersion.getVersion(); - String LibVersion = nativeGetVersion(); + String LibVersion = RXTXVersion.nativeGetVersion(); if ( devel ) { System.out.println("Devel Library"); @@ -76,7 +76,6 @@ /** Get the Serial port prefixes for the running OS */ private String deviceDirectory; private String osName; - private static native String nativeGetVersion(); private native boolean registerKnownPorts(int PortType); private native boolean isPortPrefixValid(String dev); private native boolean testRead(String dev, int type); Index: RXTXVersion.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXVersion.java,v retrieving revision 1.2.2.31 diff -u -r1.2.2.31 RXTXVersion.java --- RXTXVersion.java 16 Oct 2004 16:20:35 -0000 1.2.2.31 +++ RXTXVersion.java 7 Apr 2005 09:29:04 -0000 @@ -36,6 +36,7 @@ private static String Version; static { + System.loadLibrary( "rxtxSerial" ); Version = "RXTX-2.1-7pre20"; } /** @@ -47,4 +48,5 @@ { return(Version); } + public static native String nativeGetVersion(); } Index: SerialImp.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v retrieving revision 1.46.2.181 diff -u -r1.46.2.181 SerialImp.c --- SerialImp.c 17 Oct 2004 09:48:56 -0000 1.46.2.181 +++ SerialImp.c 7 Apr 2005 09:29:07 -0000 @@ -116,6 +116,7 @@ * It will eventually be removed. * */ #define RXTXPort(foo) Java_gnu_io_RXTXPort_ ## foo +#define RXTXVersion(foo) Java_gnu_io_RXTXVersion_ ## foo #define RXTXCommDriver(foo) Java_gnu_io_RXTXCommDriver_ ## foo #if defined(__sun__) || defined(__hpux__) @@ -4001,7 +4002,7 @@ } /*---------------------------------------------------------- -RXTXCommDriver.nativeGetVersion +RXTXVersion.nativeGetVersion accept: none perform: return the current version @@ -4010,9 +4011,10 @@ comments: This is used to avoid mixing versions of the .jar and native library. First introduced in rxtx-1.5-9 + Moved from RXTXCommDriver to RXTXVersion in rxtx-2.1-7 ----------------------------------------------------------*/ -JNIEXPORT jstring JNICALL RXTXCommDriver(nativeGetVersion) (JNIEnv *env, +JNIEXPORT jstring JNICALL RXTXVersion(nativeGetVersion) (JNIEnv *env, jclass jclazz ) { return (*env)->NewStringUTF( env, "RXTX-2.1-7pre20" ); From ricardo.trindade at emation.pt Thu Apr 7 03:45:58 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 10:45:58 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: <42550156.2040908@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050407/05212451/attachment-0014.html From thomas.shulok at lmco.com Thu Apr 7 17:43:11 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Thu, 07 Apr 2005 19:43:11 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi There, I'm attempting to talk RS232 between an embedded Linux box and a Windows box. Everything connects up fine, and I can send and receive a simple sequence of bytes with no problems. However, if around 5 seconds goes by without me sending something, I get the following when I attempt to send. java.io.IOException: Input/output error in writeArray Stack trace: java/lang/Throwable.()V java/lang/Throwable.(Ljava/lang/String;)V java/io/IOException.(Ljava/lang/String;)V gnu/io/RXTXPort.writeArray([BIIZ)V gnu/io/RXTXPort$SerialOutputStream.write([B)V SerialTest.main([Ljava/lang/String;)V If there interval is shorter (say 2 seconds between sends), I have no problems. On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and librxtxSerial-2.0.7pre2.so. Any ideas? Thanks, Thom -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5b23dcf/attachment-0014.html From taj at www.linux.org.uk Thu Apr 7 19:22:36 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:22:36 +0100 (BST) Subject: [Rxtx] Input/output error in writeArray In-Reply-To: References: Message-ID: On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a Windows > box. Everything connects up fine, and I can send and receive a simple > sequence of bytes with no problems. However, if around 5 seconds goes > by without me sending something, I get the following when I attempt to > send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Apr 7 19:24:59 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:24:59 +0100 (BST) Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) Message-ID: hmm. This would not work from applets would it? -- Trent Jarvi taj at www.linux.org.uk ---------- Forwarded message ---------- Date: Thu, 07 Apr 2005 16:05:53 -0400 From: Chris Gaffney To: taj at www.linux.org.uk Subject: RXTX Libraries on Classpath fix Hi, I submitted a patch for RXTX a few weeks ago to allow for loading the native libraries from the classpath. Since sending it to you I found it wasn't working on windows. I've fixed the problem and created a new patch that should replace the older one. The actual change is a one line from a String.equals() to a String.startsWith(). Thanks for a great piece of software, -Chris Gaffney Grand Valley State University -------------- next part -------------- A non-text attachment was scrubbed... Name: libraries_on_classpath_fixed.patch Type: text/x-patch Size: 5617 bytes Desc: Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5d423b8/libraries_on_classpath_fixed-0014.bin From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From thomas.shulok at lmco.com Fri Apr 8 10:38:55 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Fri, 08 Apr 2005 12:38:55 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi Trent, Thanks for the prompt response. Before diving deeper, I was wondering if there is a timeout parameter somewhere in the stack that I have not set properly. Given the nature of the failure (only fails if the line has been idle for a few seconds), it feels like some kind of timeout issue... Thanks again, Thom -----Original Message----- From: rxtx-bounces at mail.linuxgrrls.org [mailto:rxtx-bounces at mail.linuxgrrls.org] On Behalf Of Trent Jarvi Sent: Thursday, April 07, 2005 6:23 PM To: Java RXTX discussion Subject: Re: [Rxtx] Input/output error in writeArray On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a > Windows box. Everything connects up fine, and I can send and receive > a simple sequence of bytes with no problems. However, if around 5 > seconds goes by without me sending something, I get the following when > I attempt to send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at mail.linuxgrrls.org http://mail.linuxgrrls.org/mailman/listinfo/rxtx From ricardo.trindade at emation.pt Mon Apr 4 09:17:23 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Mon, 04 Apr 2005 16:17:23 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot Message-ID: <42515A83.4050907@emation.pt> Hi, I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most recent stable snapshot), and get the following exception : It looks like rxtx has been compiled with jdk 1.5. If this was indeed the case, I think there is a compilation flag that generates code that runs on older jdks. java.lang.UnsupportedClassVersionError: gnu/io/UnsupportedCommOperationException (Unsupported major.minor version 49.0) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at java.net.URLClassLoader.defineClass(URLClassLoader.java:251) at java.net.URLClassLoader.access$100(URLClassLoader.java:55) at java.net.URLClassLoader$1.run(URLClassLoader.java:194) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:187) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:141) I'm trying to run it with 1.4. thanks Ricardo From taj at www.linux.org.uk Tue Apr 5 00:48:12 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 07:48:12 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42515A83.4050907@emation.pt> References: <42515A83.4050907@emation.pt> Message-ID: On Mon, 4 Apr 2005, Ricardo Trindade wrote: > Hi, > > I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most > recent stable snapshot), and get the following exception : > > It looks like rxtx has been compiled with jdk 1.5. If this was > indeed the case, I think there is a compilation flag that generates code > that runs on older jdks. > > java.lang.UnsupportedClassVersionError: > gnu/io/UnsupportedCommOperationException (Unsupported major.minor > version 49.0) [snip] Thanks Ricardo I recompiled the jar with javac -source 1.3 -target 1.3. That should cover most of the JRE's in use today. I also compiled the rxtx 2.0 x86_64 native library which appeared to be missing. I tried looking for flags to pass gcc 4.0 to make the native libraries more backwards compatible but only found options for C++ which is not used in rxtx. I've got a list of other bugs that I'll be going through in the next few weeks but for now I just left them with the same CVS filename - no code changes. ftp://ftp.qbang.org/pub/rxtx/rxtx-2.0-CVS-20050120-bins.tar.gz ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-CVS-20050120-bins.tar.gz -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Tue Apr 5 02:24:33 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 05 Apr 2005 09:24:33 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: References: <42515A83.4050907@emation.pt> Message-ID: <42524B41.3040300@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050405/5919abbb/attachment-0015.html From taj at www.linux.org.uk Tue Apr 5 03:00:29 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 10:00:29 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42524B41.3040300@emation.pt> References: <42515A83.4050907@emation.pt> <42524B41.3040300@emation.pt> Message-ID: On Tue, 5 Apr 2005, Ricardo Trindade wrote: > Will you anounce to the list when a new release is available ? > There will be several incremental releases announced here. Once those are done, we will release 2.1.7 and 2.0.7. -- Trent Jarvi taj at www.linux.org.uk From no_spam at somewhere.com Tue Apr 5 11:55:37 2005 From: no_spam at somewhere.com (no_spam@somewhere.com) Date: Tue, 5 Apr 2005 13:55:37 -0400 Subject: [Rxtx] Closing a port from an event listener results in a deadlock Message-ID: <20050405175537.GA21747@rcog.homelinux.net> On the message I sent on March 14, does anyone had the chance to try the modification? Or was it already fixed? (I haven't searched the archive extensively) Or maybe my message got catched by some spam filters? (it made it to the list archive though) Anyway, I would appreciate some feedback (through the list) Thanks From taj at www.linux.org.uk Tue Apr 5 14:42:28 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 21:42:28 +0100 (BST) Subject: [Rxtx] Closing a port from an event listener results in a deadlock In-Reply-To: <20050405175537.GA21747@rcog.homelinux.net> References: <20050405175537.GA21747@rcog.homelinux.net> Message-ID: On Tue, 5 Apr 2005 no_spam at somewhere.com wrote: > On the message I sent on March 14, does anyone had the chance to try the > modification? > > Or was it already fixed? (I haven't searched the archive extensively) > > Or maybe my message got catched by some spam filters? (it made it to the list > archive though) > > Anyway, I would appreciate some feedback (through the list) > The patch is here http://marc.theaimsgroup.com/?l=rxtx&m=111084488820288&w=2 I have applied this patch to a local copy but will not be doing formal testing for a couple weeks. I do not try to close ports from inside the eventListenter usually so I encourage any feedback also. If there are no problems reported, I expect this will go into rxtx 2.1-7. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Wed Apr 6 08:33:42 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Wed, 06 Apr 2005 15:33:42 +0100 Subject: [Rxtx] getting RXTX version Message-ID: <4253F346.50102@emation.pt> Hi, I want to make sure my deployments have the same version of RXTX jar and native lib. I know the version of the jar can be obtained in the Version class, but how can I obtain the native version ? I know RXTX prints to the console a warning if the version is different. Is there a way to programatically know is this is the case ? I would like to log that to our app's log thanks Ricardo From taj at www.linux.org.uk Wed Apr 6 15:10:20 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 6 Apr 2005 22:10:20 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4253F346.50102@emation.pt> References: <4253F346.50102@emation.pt> Message-ID: On Wed, 6 Apr 2005, Ricardo Trindade wrote: > Hi, > > I want to make sure my deployments have the same version of RXTX jar > and native lib. > > I know the version of the jar can be obtained in the Version class, > but how can I obtain the native version ? > > I know RXTX prints to the console a warning if the version is > different. Is there a way to programatically know is this is the case ? > > I would like to log that to our app's log > There isn't a suggested way of doing that right now. We could move things around and have a static String RXTXVersion.getNativeVersion() in future releases. Is this what you expected? This is not documented in commapi at all. I just tossed that in to catch conflicts while developing. It would be nice to have access in GUI applications though. It may be possible to access RXTXCommDriver.LibVersion right now. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Thu Apr 7 02:51:00 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 09:51:00 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> Message-ID: <4254F474.7020905@emation.pt> >There isn't a suggested way of doing that right now. We could move things >around and have a static String RXTXVersion.getNativeVersion() in future >releases. Is this what you expected? > > Yes, that would be perfect. >This is not documented in commapi at all. I just tossed that in to catch >conflicts while developing. It would be nice to have access in GUI >applications though. > >It may be possible to access RXTXCommDriver.LibVersion right now. > > > I tried, and I don't think it's possible. From taj at www.linux.org.uk Thu Apr 7 03:32:04 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 7 Apr 2005 10:32:04 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4254F474.7020905@emation.pt> References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: On Thu, 7 Apr 2005, Ricardo Trindade wrote: > > >There isn't a suggested way of doing that right now. We could move things > >around and have a static String RXTXVersion.getNativeVersion() in future > >releases. Is this what you expected? > > > > > > Yes, that would be perfect. > The attached should do what you want. You will still need to catch an exception for older versions... -- Trent Jarvi taj at www.linux.org.uk -------------- next part -------------- ? public_version.patch Index: RXTXCommDriver.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXCommDriver.java,v retrieving revision 1.16.2.51 diff -u -r1.16.2.51 RXTXCommDriver.java --- RXTXCommDriver.java 12 Oct 2004 09:13:30 -0000 1.16.2.51 +++ RXTXCommDriver.java 7 Apr 2005 09:29:04 -0000 @@ -54,7 +54,7 @@ the Library. */ String JarVersion = RXTXVersion.getVersion(); - String LibVersion = nativeGetVersion(); + String LibVersion = RXTXVersion.nativeGetVersion(); if ( devel ) { System.out.println("Devel Library"); @@ -76,7 +76,6 @@ /** Get the Serial port prefixes for the running OS */ private String deviceDirectory; private String osName; - private static native String nativeGetVersion(); private native boolean registerKnownPorts(int PortType); private native boolean isPortPrefixValid(String dev); private native boolean testRead(String dev, int type); Index: RXTXVersion.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXVersion.java,v retrieving revision 1.2.2.31 diff -u -r1.2.2.31 RXTXVersion.java --- RXTXVersion.java 16 Oct 2004 16:20:35 -0000 1.2.2.31 +++ RXTXVersion.java 7 Apr 2005 09:29:04 -0000 @@ -36,6 +36,7 @@ private static String Version; static { + System.loadLibrary( "rxtxSerial" ); Version = "RXTX-2.1-7pre20"; } /** @@ -47,4 +48,5 @@ { return(Version); } + public static native String nativeGetVersion(); } Index: SerialImp.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v retrieving revision 1.46.2.181 diff -u -r1.46.2.181 SerialImp.c --- SerialImp.c 17 Oct 2004 09:48:56 -0000 1.46.2.181 +++ SerialImp.c 7 Apr 2005 09:29:07 -0000 @@ -116,6 +116,7 @@ * It will eventually be removed. * */ #define RXTXPort(foo) Java_gnu_io_RXTXPort_ ## foo +#define RXTXVersion(foo) Java_gnu_io_RXTXVersion_ ## foo #define RXTXCommDriver(foo) Java_gnu_io_RXTXCommDriver_ ## foo #if defined(__sun__) || defined(__hpux__) @@ -4001,7 +4002,7 @@ } /*---------------------------------------------------------- -RXTXCommDriver.nativeGetVersion +RXTXVersion.nativeGetVersion accept: none perform: return the current version @@ -4010,9 +4011,10 @@ comments: This is used to avoid mixing versions of the .jar and native library. First introduced in rxtx-1.5-9 + Moved from RXTXCommDriver to RXTXVersion in rxtx-2.1-7 ----------------------------------------------------------*/ -JNIEXPORT jstring JNICALL RXTXCommDriver(nativeGetVersion) (JNIEnv *env, +JNIEXPORT jstring JNICALL RXTXVersion(nativeGetVersion) (JNIEnv *env, jclass jclazz ) { return (*env)->NewStringUTF( env, "RXTX-2.1-7pre20" ); From ricardo.trindade at emation.pt Thu Apr 7 03:45:58 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 10:45:58 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: <42550156.2040908@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050407/05212451/attachment-0015.html From thomas.shulok at lmco.com Thu Apr 7 17:43:11 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Thu, 07 Apr 2005 19:43:11 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi There, I'm attempting to talk RS232 between an embedded Linux box and a Windows box. Everything connects up fine, and I can send and receive a simple sequence of bytes with no problems. However, if around 5 seconds goes by without me sending something, I get the following when I attempt to send. java.io.IOException: Input/output error in writeArray Stack trace: java/lang/Throwable.()V java/lang/Throwable.(Ljava/lang/String;)V java/io/IOException.(Ljava/lang/String;)V gnu/io/RXTXPort.writeArray([BIIZ)V gnu/io/RXTXPort$SerialOutputStream.write([B)V SerialTest.main([Ljava/lang/String;)V If there interval is shorter (say 2 seconds between sends), I have no problems. On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and librxtxSerial-2.0.7pre2.so. Any ideas? Thanks, Thom -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5b23dcf/attachment-0015.html From taj at www.linux.org.uk Thu Apr 7 19:22:36 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:22:36 +0100 (BST) Subject: [Rxtx] Input/output error in writeArray In-Reply-To: References: Message-ID: On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a Windows > box. Everything connects up fine, and I can send and receive a simple > sequence of bytes with no problems. However, if around 5 seconds goes > by without me sending something, I get the following when I attempt to > send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Apr 7 19:24:59 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:24:59 +0100 (BST) Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) Message-ID: hmm. This would not work from applets would it? -- Trent Jarvi taj at www.linux.org.uk ---------- Forwarded message ---------- Date: Thu, 07 Apr 2005 16:05:53 -0400 From: Chris Gaffney To: taj at www.linux.org.uk Subject: RXTX Libraries on Classpath fix Hi, I submitted a patch for RXTX a few weeks ago to allow for loading the native libraries from the classpath. Since sending it to you I found it wasn't working on windows. I've fixed the problem and created a new patch that should replace the older one. The actual change is a one line from a String.equals() to a String.startsWith(). Thanks for a great piece of software, -Chris Gaffney Grand Valley State University -------------- next part -------------- A non-text attachment was scrubbed... Name: libraries_on_classpath_fixed.patch Type: text/x-patch Size: 5617 bytes Desc: Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5d423b8/libraries_on_classpath_fixed-0015.bin From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From thomas.shulok at lmco.com Fri Apr 8 10:38:55 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Fri, 08 Apr 2005 12:38:55 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi Trent, Thanks for the prompt response. Before diving deeper, I was wondering if there is a timeout parameter somewhere in the stack that I have not set properly. Given the nature of the failure (only fails if the line has been idle for a few seconds), it feels like some kind of timeout issue... Thanks again, Thom -----Original Message----- From: rxtx-bounces at mail.linuxgrrls.org [mailto:rxtx-bounces at mail.linuxgrrls.org] On Behalf Of Trent Jarvi Sent: Thursday, April 07, 2005 6:23 PM To: Java RXTX discussion Subject: Re: [Rxtx] Input/output error in writeArray On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a > Windows box. Everything connects up fine, and I can send and receive > a simple sequence of bytes with no problems. However, if around 5 > seconds goes by without me sending something, I get the following when > I attempt to send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at mail.linuxgrrls.org http://mail.linuxgrrls.org/mailman/listinfo/rxtx From ricardo.trindade at emation.pt Mon Apr 4 09:17:23 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Mon, 04 Apr 2005 16:17:23 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot Message-ID: <42515A83.4050907@emation.pt> Hi, I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most recent stable snapshot), and get the following exception : It looks like rxtx has been compiled with jdk 1.5. If this was indeed the case, I think there is a compilation flag that generates code that runs on older jdks. java.lang.UnsupportedClassVersionError: gnu/io/UnsupportedCommOperationException (Unsupported major.minor version 49.0) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at java.net.URLClassLoader.defineClass(URLClassLoader.java:251) at java.net.URLClassLoader.access$100(URLClassLoader.java:55) at java.net.URLClassLoader$1.run(URLClassLoader.java:194) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:187) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:141) I'm trying to run it with 1.4. thanks Ricardo From taj at www.linux.org.uk Tue Apr 5 00:48:12 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 07:48:12 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42515A83.4050907@emation.pt> References: <42515A83.4050907@emation.pt> Message-ID: On Mon, 4 Apr 2005, Ricardo Trindade wrote: > Hi, > > I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most > recent stable snapshot), and get the following exception : > > It looks like rxtx has been compiled with jdk 1.5. If this was > indeed the case, I think there is a compilation flag that generates code > that runs on older jdks. > > java.lang.UnsupportedClassVersionError: > gnu/io/UnsupportedCommOperationException (Unsupported major.minor > version 49.0) [snip] Thanks Ricardo I recompiled the jar with javac -source 1.3 -target 1.3. That should cover most of the JRE's in use today. I also compiled the rxtx 2.0 x86_64 native library which appeared to be missing. I tried looking for flags to pass gcc 4.0 to make the native libraries more backwards compatible but only found options for C++ which is not used in rxtx. I've got a list of other bugs that I'll be going through in the next few weeks but for now I just left them with the same CVS filename - no code changes. ftp://ftp.qbang.org/pub/rxtx/rxtx-2.0-CVS-20050120-bins.tar.gz ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-CVS-20050120-bins.tar.gz -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Tue Apr 5 02:24:33 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 05 Apr 2005 09:24:33 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: References: <42515A83.4050907@emation.pt> Message-ID: <42524B41.3040300@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050405/5919abbb/attachment-0016.html From taj at www.linux.org.uk Tue Apr 5 03:00:29 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 10:00:29 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42524B41.3040300@emation.pt> References: <42515A83.4050907@emation.pt> <42524B41.3040300@emation.pt> Message-ID: On Tue, 5 Apr 2005, Ricardo Trindade wrote: > Will you anounce to the list when a new release is available ? > There will be several incremental releases announced here. Once those are done, we will release 2.1.7 and 2.0.7. -- Trent Jarvi taj at www.linux.org.uk From no_spam at somewhere.com Tue Apr 5 11:55:37 2005 From: no_spam at somewhere.com (no_spam@somewhere.com) Date: Tue, 5 Apr 2005 13:55:37 -0400 Subject: [Rxtx] Closing a port from an event listener results in a deadlock Message-ID: <20050405175537.GA21747@rcog.homelinux.net> On the message I sent on March 14, does anyone had the chance to try the modification? Or was it already fixed? (I haven't searched the archive extensively) Or maybe my message got catched by some spam filters? (it made it to the list archive though) Anyway, I would appreciate some feedback (through the list) Thanks From taj at www.linux.org.uk Tue Apr 5 14:42:28 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 21:42:28 +0100 (BST) Subject: [Rxtx] Closing a port from an event listener results in a deadlock In-Reply-To: <20050405175537.GA21747@rcog.homelinux.net> References: <20050405175537.GA21747@rcog.homelinux.net> Message-ID: On Tue, 5 Apr 2005 no_spam at somewhere.com wrote: > On the message I sent on March 14, does anyone had the chance to try the > modification? > > Or was it already fixed? (I haven't searched the archive extensively) > > Or maybe my message got catched by some spam filters? (it made it to the list > archive though) > > Anyway, I would appreciate some feedback (through the list) > The patch is here http://marc.theaimsgroup.com/?l=rxtx&m=111084488820288&w=2 I have applied this patch to a local copy but will not be doing formal testing for a couple weeks. I do not try to close ports from inside the eventListenter usually so I encourage any feedback also. If there are no problems reported, I expect this will go into rxtx 2.1-7. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Wed Apr 6 08:33:42 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Wed, 06 Apr 2005 15:33:42 +0100 Subject: [Rxtx] getting RXTX version Message-ID: <4253F346.50102@emation.pt> Hi, I want to make sure my deployments have the same version of RXTX jar and native lib. I know the version of the jar can be obtained in the Version class, but how can I obtain the native version ? I know RXTX prints to the console a warning if the version is different. Is there a way to programatically know is this is the case ? I would like to log that to our app's log thanks Ricardo From taj at www.linux.org.uk Wed Apr 6 15:10:20 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 6 Apr 2005 22:10:20 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4253F346.50102@emation.pt> References: <4253F346.50102@emation.pt> Message-ID: On Wed, 6 Apr 2005, Ricardo Trindade wrote: > Hi, > > I want to make sure my deployments have the same version of RXTX jar > and native lib. > > I know the version of the jar can be obtained in the Version class, > but how can I obtain the native version ? > > I know RXTX prints to the console a warning if the version is > different. Is there a way to programatically know is this is the case ? > > I would like to log that to our app's log > There isn't a suggested way of doing that right now. We could move things around and have a static String RXTXVersion.getNativeVersion() in future releases. Is this what you expected? This is not documented in commapi at all. I just tossed that in to catch conflicts while developing. It would be nice to have access in GUI applications though. It may be possible to access RXTXCommDriver.LibVersion right now. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Thu Apr 7 02:51:00 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 09:51:00 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> Message-ID: <4254F474.7020905@emation.pt> >There isn't a suggested way of doing that right now. We could move things >around and have a static String RXTXVersion.getNativeVersion() in future >releases. Is this what you expected? > > Yes, that would be perfect. >This is not documented in commapi at all. I just tossed that in to catch >conflicts while developing. It would be nice to have access in GUI >applications though. > >It may be possible to access RXTXCommDriver.LibVersion right now. > > > I tried, and I don't think it's possible. From taj at www.linux.org.uk Thu Apr 7 03:32:04 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 7 Apr 2005 10:32:04 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4254F474.7020905@emation.pt> References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: On Thu, 7 Apr 2005, Ricardo Trindade wrote: > > >There isn't a suggested way of doing that right now. We could move things > >around and have a static String RXTXVersion.getNativeVersion() in future > >releases. Is this what you expected? > > > > > > Yes, that would be perfect. > The attached should do what you want. You will still need to catch an exception for older versions... -- Trent Jarvi taj at www.linux.org.uk -------------- next part -------------- ? public_version.patch Index: RXTXCommDriver.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXCommDriver.java,v retrieving revision 1.16.2.51 diff -u -r1.16.2.51 RXTXCommDriver.java --- RXTXCommDriver.java 12 Oct 2004 09:13:30 -0000 1.16.2.51 +++ RXTXCommDriver.java 7 Apr 2005 09:29:04 -0000 @@ -54,7 +54,7 @@ the Library. */ String JarVersion = RXTXVersion.getVersion(); - String LibVersion = nativeGetVersion(); + String LibVersion = RXTXVersion.nativeGetVersion(); if ( devel ) { System.out.println("Devel Library"); @@ -76,7 +76,6 @@ /** Get the Serial port prefixes for the running OS */ private String deviceDirectory; private String osName; - private static native String nativeGetVersion(); private native boolean registerKnownPorts(int PortType); private native boolean isPortPrefixValid(String dev); private native boolean testRead(String dev, int type); Index: RXTXVersion.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXVersion.java,v retrieving revision 1.2.2.31 diff -u -r1.2.2.31 RXTXVersion.java --- RXTXVersion.java 16 Oct 2004 16:20:35 -0000 1.2.2.31 +++ RXTXVersion.java 7 Apr 2005 09:29:04 -0000 @@ -36,6 +36,7 @@ private static String Version; static { + System.loadLibrary( "rxtxSerial" ); Version = "RXTX-2.1-7pre20"; } /** @@ -47,4 +48,5 @@ { return(Version); } + public static native String nativeGetVersion(); } Index: SerialImp.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v retrieving revision 1.46.2.181 diff -u -r1.46.2.181 SerialImp.c --- SerialImp.c 17 Oct 2004 09:48:56 -0000 1.46.2.181 +++ SerialImp.c 7 Apr 2005 09:29:07 -0000 @@ -116,6 +116,7 @@ * It will eventually be removed. * */ #define RXTXPort(foo) Java_gnu_io_RXTXPort_ ## foo +#define RXTXVersion(foo) Java_gnu_io_RXTXVersion_ ## foo #define RXTXCommDriver(foo) Java_gnu_io_RXTXCommDriver_ ## foo #if defined(__sun__) || defined(__hpux__) @@ -4001,7 +4002,7 @@ } /*---------------------------------------------------------- -RXTXCommDriver.nativeGetVersion +RXTXVersion.nativeGetVersion accept: none perform: return the current version @@ -4010,9 +4011,10 @@ comments: This is used to avoid mixing versions of the .jar and native library. First introduced in rxtx-1.5-9 + Moved from RXTXCommDriver to RXTXVersion in rxtx-2.1-7 ----------------------------------------------------------*/ -JNIEXPORT jstring JNICALL RXTXCommDriver(nativeGetVersion) (JNIEnv *env, +JNIEXPORT jstring JNICALL RXTXVersion(nativeGetVersion) (JNIEnv *env, jclass jclazz ) { return (*env)->NewStringUTF( env, "RXTX-2.1-7pre20" ); From ricardo.trindade at emation.pt Thu Apr 7 03:45:58 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 10:45:58 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: <42550156.2040908@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050407/05212451/attachment-0016.html From thomas.shulok at lmco.com Thu Apr 7 17:43:11 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Thu, 07 Apr 2005 19:43:11 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi There, I'm attempting to talk RS232 between an embedded Linux box and a Windows box. Everything connects up fine, and I can send and receive a simple sequence of bytes with no problems. However, if around 5 seconds goes by without me sending something, I get the following when I attempt to send. java.io.IOException: Input/output error in writeArray Stack trace: java/lang/Throwable.()V java/lang/Throwable.(Ljava/lang/String;)V java/io/IOException.(Ljava/lang/String;)V gnu/io/RXTXPort.writeArray([BIIZ)V gnu/io/RXTXPort$SerialOutputStream.write([B)V SerialTest.main([Ljava/lang/String;)V If there interval is shorter (say 2 seconds between sends), I have no problems. On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and librxtxSerial-2.0.7pre2.so. Any ideas? Thanks, Thom -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5b23dcf/attachment-0016.html From taj at www.linux.org.uk Thu Apr 7 19:22:36 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:22:36 +0100 (BST) Subject: [Rxtx] Input/output error in writeArray In-Reply-To: References: Message-ID: On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a Windows > box. Everything connects up fine, and I can send and receive a simple > sequence of bytes with no problems. However, if around 5 seconds goes > by without me sending something, I get the following when I attempt to > send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Apr 7 19:24:59 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:24:59 +0100 (BST) Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) Message-ID: hmm. This would not work from applets would it? -- Trent Jarvi taj at www.linux.org.uk ---------- Forwarded message ---------- Date: Thu, 07 Apr 2005 16:05:53 -0400 From: Chris Gaffney To: taj at www.linux.org.uk Subject: RXTX Libraries on Classpath fix Hi, I submitted a patch for RXTX a few weeks ago to allow for loading the native libraries from the classpath. Since sending it to you I found it wasn't working on windows. I've fixed the problem and created a new patch that should replace the older one. The actual change is a one line from a String.equals() to a String.startsWith(). Thanks for a great piece of software, -Chris Gaffney Grand Valley State University -------------- next part -------------- A non-text attachment was scrubbed... Name: libraries_on_classpath_fixed.patch Type: text/x-patch Size: 5617 bytes Desc: Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5d423b8/libraries_on_classpath_fixed-0016.bin From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From thomas.shulok at lmco.com Fri Apr 8 10:38:55 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Fri, 08 Apr 2005 12:38:55 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi Trent, Thanks for the prompt response. Before diving deeper, I was wondering if there is a timeout parameter somewhere in the stack that I have not set properly. Given the nature of the failure (only fails if the line has been idle for a few seconds), it feels like some kind of timeout issue... Thanks again, Thom -----Original Message----- From: rxtx-bounces at mail.linuxgrrls.org [mailto:rxtx-bounces at mail.linuxgrrls.org] On Behalf Of Trent Jarvi Sent: Thursday, April 07, 2005 6:23 PM To: Java RXTX discussion Subject: Re: [Rxtx] Input/output error in writeArray On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a > Windows box. Everything connects up fine, and I can send and receive > a simple sequence of bytes with no problems. However, if around 5 > seconds goes by without me sending something, I get the following when > I attempt to send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at mail.linuxgrrls.org http://mail.linuxgrrls.org/mailman/listinfo/rxtx From ricardo.trindade at emation.pt Mon Apr 4 09:17:23 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Mon, 04 Apr 2005 16:17:23 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot Message-ID: <42515A83.4050907@emation.pt> Hi, I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most recent stable snapshot), and get the following exception : It looks like rxtx has been compiled with jdk 1.5. If this was indeed the case, I think there is a compilation flag that generates code that runs on older jdks. java.lang.UnsupportedClassVersionError: gnu/io/UnsupportedCommOperationException (Unsupported major.minor version 49.0) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at java.net.URLClassLoader.defineClass(URLClassLoader.java:251) at java.net.URLClassLoader.access$100(URLClassLoader.java:55) at java.net.URLClassLoader$1.run(URLClassLoader.java:194) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:187) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:141) I'm trying to run it with 1.4. thanks Ricardo From taj at www.linux.org.uk Tue Apr 5 00:48:12 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 07:48:12 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42515A83.4050907@emation.pt> References: <42515A83.4050907@emation.pt> Message-ID: On Mon, 4 Apr 2005, Ricardo Trindade wrote: > Hi, > > I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most > recent stable snapshot), and get the following exception : > > It looks like rxtx has been compiled with jdk 1.5. If this was > indeed the case, I think there is a compilation flag that generates code > that runs on older jdks. > > java.lang.UnsupportedClassVersionError: > gnu/io/UnsupportedCommOperationException (Unsupported major.minor > version 49.0) [snip] Thanks Ricardo I recompiled the jar with javac -source 1.3 -target 1.3. That should cover most of the JRE's in use today. I also compiled the rxtx 2.0 x86_64 native library which appeared to be missing. I tried looking for flags to pass gcc 4.0 to make the native libraries more backwards compatible but only found options for C++ which is not used in rxtx. I've got a list of other bugs that I'll be going through in the next few weeks but for now I just left them with the same CVS filename - no code changes. ftp://ftp.qbang.org/pub/rxtx/rxtx-2.0-CVS-20050120-bins.tar.gz ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-CVS-20050120-bins.tar.gz -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Tue Apr 5 02:24:33 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 05 Apr 2005 09:24:33 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: References: <42515A83.4050907@emation.pt> Message-ID: <42524B41.3040300@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050405/5919abbb/attachment-0017.html From taj at www.linux.org.uk Tue Apr 5 03:00:29 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 10:00:29 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42524B41.3040300@emation.pt> References: <42515A83.4050907@emation.pt> <42524B41.3040300@emation.pt> Message-ID: On Tue, 5 Apr 2005, Ricardo Trindade wrote: > Will you anounce to the list when a new release is available ? > There will be several incremental releases announced here. Once those are done, we will release 2.1.7 and 2.0.7. -- Trent Jarvi taj at www.linux.org.uk From no_spam at somewhere.com Tue Apr 5 11:55:37 2005 From: no_spam at somewhere.com (no_spam@somewhere.com) Date: Tue, 5 Apr 2005 13:55:37 -0400 Subject: [Rxtx] Closing a port from an event listener results in a deadlock Message-ID: <20050405175537.GA21747@rcog.homelinux.net> On the message I sent on March 14, does anyone had the chance to try the modification? Or was it already fixed? (I haven't searched the archive extensively) Or maybe my message got catched by some spam filters? (it made it to the list archive though) Anyway, I would appreciate some feedback (through the list) Thanks From taj at www.linux.org.uk Tue Apr 5 14:42:28 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 21:42:28 +0100 (BST) Subject: [Rxtx] Closing a port from an event listener results in a deadlock In-Reply-To: <20050405175537.GA21747@rcog.homelinux.net> References: <20050405175537.GA21747@rcog.homelinux.net> Message-ID: On Tue, 5 Apr 2005 no_spam at somewhere.com wrote: > On the message I sent on March 14, does anyone had the chance to try the > modification? > > Or was it already fixed? (I haven't searched the archive extensively) > > Or maybe my message got catched by some spam filters? (it made it to the list > archive though) > > Anyway, I would appreciate some feedback (through the list) > The patch is here http://marc.theaimsgroup.com/?l=rxtx&m=111084488820288&w=2 I have applied this patch to a local copy but will not be doing formal testing for a couple weeks. I do not try to close ports from inside the eventListenter usually so I encourage any feedback also. If there are no problems reported, I expect this will go into rxtx 2.1-7. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Wed Apr 6 08:33:42 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Wed, 06 Apr 2005 15:33:42 +0100 Subject: [Rxtx] getting RXTX version Message-ID: <4253F346.50102@emation.pt> Hi, I want to make sure my deployments have the same version of RXTX jar and native lib. I know the version of the jar can be obtained in the Version class, but how can I obtain the native version ? I know RXTX prints to the console a warning if the version is different. Is there a way to programatically know is this is the case ? I would like to log that to our app's log thanks Ricardo From taj at www.linux.org.uk Wed Apr 6 15:10:20 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 6 Apr 2005 22:10:20 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4253F346.50102@emation.pt> References: <4253F346.50102@emation.pt> Message-ID: On Wed, 6 Apr 2005, Ricardo Trindade wrote: > Hi, > > I want to make sure my deployments have the same version of RXTX jar > and native lib. > > I know the version of the jar can be obtained in the Version class, > but how can I obtain the native version ? > > I know RXTX prints to the console a warning if the version is > different. Is there a way to programatically know is this is the case ? > > I would like to log that to our app's log > There isn't a suggested way of doing that right now. We could move things around and have a static String RXTXVersion.getNativeVersion() in future releases. Is this what you expected? This is not documented in commapi at all. I just tossed that in to catch conflicts while developing. It would be nice to have access in GUI applications though. It may be possible to access RXTXCommDriver.LibVersion right now. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Thu Apr 7 02:51:00 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 09:51:00 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> Message-ID: <4254F474.7020905@emation.pt> >There isn't a suggested way of doing that right now. We could move things >around and have a static String RXTXVersion.getNativeVersion() in future >releases. Is this what you expected? > > Yes, that would be perfect. >This is not documented in commapi at all. I just tossed that in to catch >conflicts while developing. It would be nice to have access in GUI >applications though. > >It may be possible to access RXTXCommDriver.LibVersion right now. > > > I tried, and I don't think it's possible. From taj at www.linux.org.uk Thu Apr 7 03:32:04 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 7 Apr 2005 10:32:04 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4254F474.7020905@emation.pt> References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: On Thu, 7 Apr 2005, Ricardo Trindade wrote: > > >There isn't a suggested way of doing that right now. We could move things > >around and have a static String RXTXVersion.getNativeVersion() in future > >releases. Is this what you expected? > > > > > > Yes, that would be perfect. > The attached should do what you want. You will still need to catch an exception for older versions... -- Trent Jarvi taj at www.linux.org.uk -------------- next part -------------- ? public_version.patch Index: RXTXCommDriver.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXCommDriver.java,v retrieving revision 1.16.2.51 diff -u -r1.16.2.51 RXTXCommDriver.java --- RXTXCommDriver.java 12 Oct 2004 09:13:30 -0000 1.16.2.51 +++ RXTXCommDriver.java 7 Apr 2005 09:29:04 -0000 @@ -54,7 +54,7 @@ the Library. */ String JarVersion = RXTXVersion.getVersion(); - String LibVersion = nativeGetVersion(); + String LibVersion = RXTXVersion.nativeGetVersion(); if ( devel ) { System.out.println("Devel Library"); @@ -76,7 +76,6 @@ /** Get the Serial port prefixes for the running OS */ private String deviceDirectory; private String osName; - private static native String nativeGetVersion(); private native boolean registerKnownPorts(int PortType); private native boolean isPortPrefixValid(String dev); private native boolean testRead(String dev, int type); Index: RXTXVersion.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXVersion.java,v retrieving revision 1.2.2.31 diff -u -r1.2.2.31 RXTXVersion.java --- RXTXVersion.java 16 Oct 2004 16:20:35 -0000 1.2.2.31 +++ RXTXVersion.java 7 Apr 2005 09:29:04 -0000 @@ -36,6 +36,7 @@ private static String Version; static { + System.loadLibrary( "rxtxSerial" ); Version = "RXTX-2.1-7pre20"; } /** @@ -47,4 +48,5 @@ { return(Version); } + public static native String nativeGetVersion(); } Index: SerialImp.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v retrieving revision 1.46.2.181 diff -u -r1.46.2.181 SerialImp.c --- SerialImp.c 17 Oct 2004 09:48:56 -0000 1.46.2.181 +++ SerialImp.c 7 Apr 2005 09:29:07 -0000 @@ -116,6 +116,7 @@ * It will eventually be removed. * */ #define RXTXPort(foo) Java_gnu_io_RXTXPort_ ## foo +#define RXTXVersion(foo) Java_gnu_io_RXTXVersion_ ## foo #define RXTXCommDriver(foo) Java_gnu_io_RXTXCommDriver_ ## foo #if defined(__sun__) || defined(__hpux__) @@ -4001,7 +4002,7 @@ } /*---------------------------------------------------------- -RXTXCommDriver.nativeGetVersion +RXTXVersion.nativeGetVersion accept: none perform: return the current version @@ -4010,9 +4011,10 @@ comments: This is used to avoid mixing versions of the .jar and native library. First introduced in rxtx-1.5-9 + Moved from RXTXCommDriver to RXTXVersion in rxtx-2.1-7 ----------------------------------------------------------*/ -JNIEXPORT jstring JNICALL RXTXCommDriver(nativeGetVersion) (JNIEnv *env, +JNIEXPORT jstring JNICALL RXTXVersion(nativeGetVersion) (JNIEnv *env, jclass jclazz ) { return (*env)->NewStringUTF( env, "RXTX-2.1-7pre20" ); From ricardo.trindade at emation.pt Thu Apr 7 03:45:58 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 10:45:58 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: <42550156.2040908@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050407/05212451/attachment-0017.html From thomas.shulok at lmco.com Thu Apr 7 17:43:11 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Thu, 07 Apr 2005 19:43:11 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi There, I'm attempting to talk RS232 between an embedded Linux box and a Windows box. Everything connects up fine, and I can send and receive a simple sequence of bytes with no problems. However, if around 5 seconds goes by without me sending something, I get the following when I attempt to send. java.io.IOException: Input/output error in writeArray Stack trace: java/lang/Throwable.()V java/lang/Throwable.(Ljava/lang/String;)V java/io/IOException.(Ljava/lang/String;)V gnu/io/RXTXPort.writeArray([BIIZ)V gnu/io/RXTXPort$SerialOutputStream.write([B)V SerialTest.main([Ljava/lang/String;)V If there interval is shorter (say 2 seconds between sends), I have no problems. On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and librxtxSerial-2.0.7pre2.so. Any ideas? Thanks, Thom -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5b23dcf/attachment-0017.html From taj at www.linux.org.uk Thu Apr 7 19:22:36 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:22:36 +0100 (BST) Subject: [Rxtx] Input/output error in writeArray In-Reply-To: References: Message-ID: On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a Windows > box. Everything connects up fine, and I can send and receive a simple > sequence of bytes with no problems. However, if around 5 seconds goes > by without me sending something, I get the following when I attempt to > send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Apr 7 19:24:59 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:24:59 +0100 (BST) Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) Message-ID: hmm. This would not work from applets would it? -- Trent Jarvi taj at www.linux.org.uk ---------- Forwarded message ---------- Date: Thu, 07 Apr 2005 16:05:53 -0400 From: Chris Gaffney To: taj at www.linux.org.uk Subject: RXTX Libraries on Classpath fix Hi, I submitted a patch for RXTX a few weeks ago to allow for loading the native libraries from the classpath. Since sending it to you I found it wasn't working on windows. I've fixed the problem and created a new patch that should replace the older one. The actual change is a one line from a String.equals() to a String.startsWith(). Thanks for a great piece of software, -Chris Gaffney Grand Valley State University -------------- next part -------------- A non-text attachment was scrubbed... Name: libraries_on_classpath_fixed.patch Type: text/x-patch Size: 5617 bytes Desc: Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5d423b8/libraries_on_classpath_fixed-0017.bin From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From thomas.shulok at lmco.com Fri Apr 8 10:38:55 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Fri, 08 Apr 2005 12:38:55 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi Trent, Thanks for the prompt response. Before diving deeper, I was wondering if there is a timeout parameter somewhere in the stack that I have not set properly. Given the nature of the failure (only fails if the line has been idle for a few seconds), it feels like some kind of timeout issue... Thanks again, Thom -----Original Message----- From: rxtx-bounces at mail.linuxgrrls.org [mailto:rxtx-bounces at mail.linuxgrrls.org] On Behalf Of Trent Jarvi Sent: Thursday, April 07, 2005 6:23 PM To: Java RXTX discussion Subject: Re: [Rxtx] Input/output error in writeArray On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a > Windows box. Everything connects up fine, and I can send and receive > a simple sequence of bytes with no problems. However, if around 5 > seconds goes by without me sending something, I get the following when > I attempt to send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at mail.linuxgrrls.org http://mail.linuxgrrls.org/mailman/listinfo/rxtx From ricardo.trindade at emation.pt Mon Apr 4 09:17:23 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Mon, 04 Apr 2005 16:17:23 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot Message-ID: <42515A83.4050907@emation.pt> Hi, I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most recent stable snapshot), and get the following exception : It looks like rxtx has been compiled with jdk 1.5. If this was indeed the case, I think there is a compilation flag that generates code that runs on older jdks. java.lang.UnsupportedClassVersionError: gnu/io/UnsupportedCommOperationException (Unsupported major.minor version 49.0) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at java.net.URLClassLoader.defineClass(URLClassLoader.java:251) at java.net.URLClassLoader.access$100(URLClassLoader.java:55) at java.net.URLClassLoader$1.run(URLClassLoader.java:194) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:187) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:141) I'm trying to run it with 1.4. thanks Ricardo From taj at www.linux.org.uk Tue Apr 5 00:48:12 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 07:48:12 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42515A83.4050907@emation.pt> References: <42515A83.4050907@emation.pt> Message-ID: On Mon, 4 Apr 2005, Ricardo Trindade wrote: > Hi, > > I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most > recent stable snapshot), and get the following exception : > > It looks like rxtx has been compiled with jdk 1.5. If this was > indeed the case, I think there is a compilation flag that generates code > that runs on older jdks. > > java.lang.UnsupportedClassVersionError: > gnu/io/UnsupportedCommOperationException (Unsupported major.minor > version 49.0) [snip] Thanks Ricardo I recompiled the jar with javac -source 1.3 -target 1.3. That should cover most of the JRE's in use today. I also compiled the rxtx 2.0 x86_64 native library which appeared to be missing. I tried looking for flags to pass gcc 4.0 to make the native libraries more backwards compatible but only found options for C++ which is not used in rxtx. I've got a list of other bugs that I'll be going through in the next few weeks but for now I just left them with the same CVS filename - no code changes. ftp://ftp.qbang.org/pub/rxtx/rxtx-2.0-CVS-20050120-bins.tar.gz ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-CVS-20050120-bins.tar.gz -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Tue Apr 5 02:24:33 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 05 Apr 2005 09:24:33 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: References: <42515A83.4050907@emation.pt> Message-ID: <42524B41.3040300@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050405/5919abbb/attachment-0018.html From taj at www.linux.org.uk Tue Apr 5 03:00:29 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 10:00:29 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42524B41.3040300@emation.pt> References: <42515A83.4050907@emation.pt> <42524B41.3040300@emation.pt> Message-ID: On Tue, 5 Apr 2005, Ricardo Trindade wrote: > Will you anounce to the list when a new release is available ? > There will be several incremental releases announced here. Once those are done, we will release 2.1.7 and 2.0.7. -- Trent Jarvi taj at www.linux.org.uk From no_spam at somewhere.com Tue Apr 5 11:55:37 2005 From: no_spam at somewhere.com (no_spam@somewhere.com) Date: Tue, 5 Apr 2005 13:55:37 -0400 Subject: [Rxtx] Closing a port from an event listener results in a deadlock Message-ID: <20050405175537.GA21747@rcog.homelinux.net> On the message I sent on March 14, does anyone had the chance to try the modification? Or was it already fixed? (I haven't searched the archive extensively) Or maybe my message got catched by some spam filters? (it made it to the list archive though) Anyway, I would appreciate some feedback (through the list) Thanks From taj at www.linux.org.uk Tue Apr 5 14:42:28 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 21:42:28 +0100 (BST) Subject: [Rxtx] Closing a port from an event listener results in a deadlock In-Reply-To: <20050405175537.GA21747@rcog.homelinux.net> References: <20050405175537.GA21747@rcog.homelinux.net> Message-ID: On Tue, 5 Apr 2005 no_spam at somewhere.com wrote: > On the message I sent on March 14, does anyone had the chance to try the > modification? > > Or was it already fixed? (I haven't searched the archive extensively) > > Or maybe my message got catched by some spam filters? (it made it to the list > archive though) > > Anyway, I would appreciate some feedback (through the list) > The patch is here http://marc.theaimsgroup.com/?l=rxtx&m=111084488820288&w=2 I have applied this patch to a local copy but will not be doing formal testing for a couple weeks. I do not try to close ports from inside the eventListenter usually so I encourage any feedback also. If there are no problems reported, I expect this will go into rxtx 2.1-7. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Wed Apr 6 08:33:42 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Wed, 06 Apr 2005 15:33:42 +0100 Subject: [Rxtx] getting RXTX version Message-ID: <4253F346.50102@emation.pt> Hi, I want to make sure my deployments have the same version of RXTX jar and native lib. I know the version of the jar can be obtained in the Version class, but how can I obtain the native version ? I know RXTX prints to the console a warning if the version is different. Is there a way to programatically know is this is the case ? I would like to log that to our app's log thanks Ricardo From taj at www.linux.org.uk Wed Apr 6 15:10:20 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 6 Apr 2005 22:10:20 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4253F346.50102@emation.pt> References: <4253F346.50102@emation.pt> Message-ID: On Wed, 6 Apr 2005, Ricardo Trindade wrote: > Hi, > > I want to make sure my deployments have the same version of RXTX jar > and native lib. > > I know the version of the jar can be obtained in the Version class, > but how can I obtain the native version ? > > I know RXTX prints to the console a warning if the version is > different. Is there a way to programatically know is this is the case ? > > I would like to log that to our app's log > There isn't a suggested way of doing that right now. We could move things around and have a static String RXTXVersion.getNativeVersion() in future releases. Is this what you expected? This is not documented in commapi at all. I just tossed that in to catch conflicts while developing. It would be nice to have access in GUI applications though. It may be possible to access RXTXCommDriver.LibVersion right now. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Thu Apr 7 02:51:00 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 09:51:00 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> Message-ID: <4254F474.7020905@emation.pt> >There isn't a suggested way of doing that right now. We could move things >around and have a static String RXTXVersion.getNativeVersion() in future >releases. Is this what you expected? > > Yes, that would be perfect. >This is not documented in commapi at all. I just tossed that in to catch >conflicts while developing. It would be nice to have access in GUI >applications though. > >It may be possible to access RXTXCommDriver.LibVersion right now. > > > I tried, and I don't think it's possible. From taj at www.linux.org.uk Thu Apr 7 03:32:04 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 7 Apr 2005 10:32:04 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4254F474.7020905@emation.pt> References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: On Thu, 7 Apr 2005, Ricardo Trindade wrote: > > >There isn't a suggested way of doing that right now. We could move things > >around and have a static String RXTXVersion.getNativeVersion() in future > >releases. Is this what you expected? > > > > > > Yes, that would be perfect. > The attached should do what you want. You will still need to catch an exception for older versions... -- Trent Jarvi taj at www.linux.org.uk -------------- next part -------------- ? public_version.patch Index: RXTXCommDriver.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXCommDriver.java,v retrieving revision 1.16.2.51 diff -u -r1.16.2.51 RXTXCommDriver.java --- RXTXCommDriver.java 12 Oct 2004 09:13:30 -0000 1.16.2.51 +++ RXTXCommDriver.java 7 Apr 2005 09:29:04 -0000 @@ -54,7 +54,7 @@ the Library. */ String JarVersion = RXTXVersion.getVersion(); - String LibVersion = nativeGetVersion(); + String LibVersion = RXTXVersion.nativeGetVersion(); if ( devel ) { System.out.println("Devel Library"); @@ -76,7 +76,6 @@ /** Get the Serial port prefixes for the running OS */ private String deviceDirectory; private String osName; - private static native String nativeGetVersion(); private native boolean registerKnownPorts(int PortType); private native boolean isPortPrefixValid(String dev); private native boolean testRead(String dev, int type); Index: RXTXVersion.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXVersion.java,v retrieving revision 1.2.2.31 diff -u -r1.2.2.31 RXTXVersion.java --- RXTXVersion.java 16 Oct 2004 16:20:35 -0000 1.2.2.31 +++ RXTXVersion.java 7 Apr 2005 09:29:04 -0000 @@ -36,6 +36,7 @@ private static String Version; static { + System.loadLibrary( "rxtxSerial" ); Version = "RXTX-2.1-7pre20"; } /** @@ -47,4 +48,5 @@ { return(Version); } + public static native String nativeGetVersion(); } Index: SerialImp.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v retrieving revision 1.46.2.181 diff -u -r1.46.2.181 SerialImp.c --- SerialImp.c 17 Oct 2004 09:48:56 -0000 1.46.2.181 +++ SerialImp.c 7 Apr 2005 09:29:07 -0000 @@ -116,6 +116,7 @@ * It will eventually be removed. * */ #define RXTXPort(foo) Java_gnu_io_RXTXPort_ ## foo +#define RXTXVersion(foo) Java_gnu_io_RXTXVersion_ ## foo #define RXTXCommDriver(foo) Java_gnu_io_RXTXCommDriver_ ## foo #if defined(__sun__) || defined(__hpux__) @@ -4001,7 +4002,7 @@ } /*---------------------------------------------------------- -RXTXCommDriver.nativeGetVersion +RXTXVersion.nativeGetVersion accept: none perform: return the current version @@ -4010,9 +4011,10 @@ comments: This is used to avoid mixing versions of the .jar and native library. First introduced in rxtx-1.5-9 + Moved from RXTXCommDriver to RXTXVersion in rxtx-2.1-7 ----------------------------------------------------------*/ -JNIEXPORT jstring JNICALL RXTXCommDriver(nativeGetVersion) (JNIEnv *env, +JNIEXPORT jstring JNICALL RXTXVersion(nativeGetVersion) (JNIEnv *env, jclass jclazz ) { return (*env)->NewStringUTF( env, "RXTX-2.1-7pre20" ); From ricardo.trindade at emation.pt Thu Apr 7 03:45:58 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 10:45:58 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: <42550156.2040908@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050407/05212451/attachment-0018.html From thomas.shulok at lmco.com Thu Apr 7 17:43:11 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Thu, 07 Apr 2005 19:43:11 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi There, I'm attempting to talk RS232 between an embedded Linux box and a Windows box. Everything connects up fine, and I can send and receive a simple sequence of bytes with no problems. However, if around 5 seconds goes by without me sending something, I get the following when I attempt to send. java.io.IOException: Input/output error in writeArray Stack trace: java/lang/Throwable.()V java/lang/Throwable.(Ljava/lang/String;)V java/io/IOException.(Ljava/lang/String;)V gnu/io/RXTXPort.writeArray([BIIZ)V gnu/io/RXTXPort$SerialOutputStream.write([B)V SerialTest.main([Ljava/lang/String;)V If there interval is shorter (say 2 seconds between sends), I have no problems. On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and librxtxSerial-2.0.7pre2.so. Any ideas? Thanks, Thom -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5b23dcf/attachment-0018.html From taj at www.linux.org.uk Thu Apr 7 19:22:36 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:22:36 +0100 (BST) Subject: [Rxtx] Input/output error in writeArray In-Reply-To: References: Message-ID: On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a Windows > box. Everything connects up fine, and I can send and receive a simple > sequence of bytes with no problems. However, if around 5 seconds goes > by without me sending something, I get the following when I attempt to > send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Apr 7 19:24:59 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:24:59 +0100 (BST) Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) Message-ID: hmm. This would not work from applets would it? -- Trent Jarvi taj at www.linux.org.uk ---------- Forwarded message ---------- Date: Thu, 07 Apr 2005 16:05:53 -0400 From: Chris Gaffney To: taj at www.linux.org.uk Subject: RXTX Libraries on Classpath fix Hi, I submitted a patch for RXTX a few weeks ago to allow for loading the native libraries from the classpath. Since sending it to you I found it wasn't working on windows. I've fixed the problem and created a new patch that should replace the older one. The actual change is a one line from a String.equals() to a String.startsWith(). Thanks for a great piece of software, -Chris Gaffney Grand Valley State University -------------- next part -------------- A non-text attachment was scrubbed... Name: libraries_on_classpath_fixed.patch Type: text/x-patch Size: 5617 bytes Desc: Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5d423b8/libraries_on_classpath_fixed-0018.bin From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From thomas.shulok at lmco.com Fri Apr 8 10:38:55 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Fri, 08 Apr 2005 12:38:55 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi Trent, Thanks for the prompt response. Before diving deeper, I was wondering if there is a timeout parameter somewhere in the stack that I have not set properly. Given the nature of the failure (only fails if the line has been idle for a few seconds), it feels like some kind of timeout issue... Thanks again, Thom -----Original Message----- From: rxtx-bounces at mail.linuxgrrls.org [mailto:rxtx-bounces at mail.linuxgrrls.org] On Behalf Of Trent Jarvi Sent: Thursday, April 07, 2005 6:23 PM To: Java RXTX discussion Subject: Re: [Rxtx] Input/output error in writeArray On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a > Windows box. Everything connects up fine, and I can send and receive > a simple sequence of bytes with no problems. However, if around 5 > seconds goes by without me sending something, I get the following when > I attempt to send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at mail.linuxgrrls.org http://mail.linuxgrrls.org/mailman/listinfo/rxtx From ricardo.trindade at emation.pt Mon Apr 4 09:17:23 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Mon, 04 Apr 2005 16:17:23 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot Message-ID: <42515A83.4050907@emation.pt> Hi, I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most recent stable snapshot), and get the following exception : It looks like rxtx has been compiled with jdk 1.5. If this was indeed the case, I think there is a compilation flag that generates code that runs on older jdks. java.lang.UnsupportedClassVersionError: gnu/io/UnsupportedCommOperationException (Unsupported major.minor version 49.0) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at java.net.URLClassLoader.defineClass(URLClassLoader.java:251) at java.net.URLClassLoader.access$100(URLClassLoader.java:55) at java.net.URLClassLoader$1.run(URLClassLoader.java:194) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:187) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:141) I'm trying to run it with 1.4. thanks Ricardo From taj at www.linux.org.uk Tue Apr 5 00:48:12 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 07:48:12 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42515A83.4050907@emation.pt> References: <42515A83.4050907@emation.pt> Message-ID: On Mon, 4 Apr 2005, Ricardo Trindade wrote: > Hi, > > I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most > recent stable snapshot), and get the following exception : > > It looks like rxtx has been compiled with jdk 1.5. If this was > indeed the case, I think there is a compilation flag that generates code > that runs on older jdks. > > java.lang.UnsupportedClassVersionError: > gnu/io/UnsupportedCommOperationException (Unsupported major.minor > version 49.0) [snip] Thanks Ricardo I recompiled the jar with javac -source 1.3 -target 1.3. That should cover most of the JRE's in use today. I also compiled the rxtx 2.0 x86_64 native library which appeared to be missing. I tried looking for flags to pass gcc 4.0 to make the native libraries more backwards compatible but only found options for C++ which is not used in rxtx. I've got a list of other bugs that I'll be going through in the next few weeks but for now I just left them with the same CVS filename - no code changes. ftp://ftp.qbang.org/pub/rxtx/rxtx-2.0-CVS-20050120-bins.tar.gz ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-CVS-20050120-bins.tar.gz -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Tue Apr 5 02:24:33 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 05 Apr 2005 09:24:33 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: References: <42515A83.4050907@emation.pt> Message-ID: <42524B41.3040300@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050405/5919abbb/attachment-0019.html From taj at www.linux.org.uk Tue Apr 5 03:00:29 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 10:00:29 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42524B41.3040300@emation.pt> References: <42515A83.4050907@emation.pt> <42524B41.3040300@emation.pt> Message-ID: On Tue, 5 Apr 2005, Ricardo Trindade wrote: > Will you anounce to the list when a new release is available ? > There will be several incremental releases announced here. Once those are done, we will release 2.1.7 and 2.0.7. -- Trent Jarvi taj at www.linux.org.uk From no_spam at somewhere.com Tue Apr 5 11:55:37 2005 From: no_spam at somewhere.com (no_spam@somewhere.com) Date: Tue, 5 Apr 2005 13:55:37 -0400 Subject: [Rxtx] Closing a port from an event listener results in a deadlock Message-ID: <20050405175537.GA21747@rcog.homelinux.net> On the message I sent on March 14, does anyone had the chance to try the modification? Or was it already fixed? (I haven't searched the archive extensively) Or maybe my message got catched by some spam filters? (it made it to the list archive though) Anyway, I would appreciate some feedback (through the list) Thanks From taj at www.linux.org.uk Tue Apr 5 14:42:28 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 21:42:28 +0100 (BST) Subject: [Rxtx] Closing a port from an event listener results in a deadlock In-Reply-To: <20050405175537.GA21747@rcog.homelinux.net> References: <20050405175537.GA21747@rcog.homelinux.net> Message-ID: On Tue, 5 Apr 2005 no_spam at somewhere.com wrote: > On the message I sent on March 14, does anyone had the chance to try the > modification? > > Or was it already fixed? (I haven't searched the archive extensively) > > Or maybe my message got catched by some spam filters? (it made it to the list > archive though) > > Anyway, I would appreciate some feedback (through the list) > The patch is here http://marc.theaimsgroup.com/?l=rxtx&m=111084488820288&w=2 I have applied this patch to a local copy but will not be doing formal testing for a couple weeks. I do not try to close ports from inside the eventListenter usually so I encourage any feedback also. If there are no problems reported, I expect this will go into rxtx 2.1-7. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Wed Apr 6 08:33:42 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Wed, 06 Apr 2005 15:33:42 +0100 Subject: [Rxtx] getting RXTX version Message-ID: <4253F346.50102@emation.pt> Hi, I want to make sure my deployments have the same version of RXTX jar and native lib. I know the version of the jar can be obtained in the Version class, but how can I obtain the native version ? I know RXTX prints to the console a warning if the version is different. Is there a way to programatically know is this is the case ? I would like to log that to our app's log thanks Ricardo From taj at www.linux.org.uk Wed Apr 6 15:10:20 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 6 Apr 2005 22:10:20 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4253F346.50102@emation.pt> References: <4253F346.50102@emation.pt> Message-ID: On Wed, 6 Apr 2005, Ricardo Trindade wrote: > Hi, > > I want to make sure my deployments have the same version of RXTX jar > and native lib. > > I know the version of the jar can be obtained in the Version class, > but how can I obtain the native version ? > > I know RXTX prints to the console a warning if the version is > different. Is there a way to programatically know is this is the case ? > > I would like to log that to our app's log > There isn't a suggested way of doing that right now. We could move things around and have a static String RXTXVersion.getNativeVersion() in future releases. Is this what you expected? This is not documented in commapi at all. I just tossed that in to catch conflicts while developing. It would be nice to have access in GUI applications though. It may be possible to access RXTXCommDriver.LibVersion right now. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Thu Apr 7 02:51:00 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 09:51:00 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> Message-ID: <4254F474.7020905@emation.pt> >There isn't a suggested way of doing that right now. We could move things >around and have a static String RXTXVersion.getNativeVersion() in future >releases. Is this what you expected? > > Yes, that would be perfect. >This is not documented in commapi at all. I just tossed that in to catch >conflicts while developing. It would be nice to have access in GUI >applications though. > >It may be possible to access RXTXCommDriver.LibVersion right now. > > > I tried, and I don't think it's possible. From taj at www.linux.org.uk Thu Apr 7 03:32:04 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 7 Apr 2005 10:32:04 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4254F474.7020905@emation.pt> References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: On Thu, 7 Apr 2005, Ricardo Trindade wrote: > > >There isn't a suggested way of doing that right now. We could move things > >around and have a static String RXTXVersion.getNativeVersion() in future > >releases. Is this what you expected? > > > > > > Yes, that would be perfect. > The attached should do what you want. You will still need to catch an exception for older versions... -- Trent Jarvi taj at www.linux.org.uk -------------- next part -------------- ? public_version.patch Index: RXTXCommDriver.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXCommDriver.java,v retrieving revision 1.16.2.51 diff -u -r1.16.2.51 RXTXCommDriver.java --- RXTXCommDriver.java 12 Oct 2004 09:13:30 -0000 1.16.2.51 +++ RXTXCommDriver.java 7 Apr 2005 09:29:04 -0000 @@ -54,7 +54,7 @@ the Library. */ String JarVersion = RXTXVersion.getVersion(); - String LibVersion = nativeGetVersion(); + String LibVersion = RXTXVersion.nativeGetVersion(); if ( devel ) { System.out.println("Devel Library"); @@ -76,7 +76,6 @@ /** Get the Serial port prefixes for the running OS */ private String deviceDirectory; private String osName; - private static native String nativeGetVersion(); private native boolean registerKnownPorts(int PortType); private native boolean isPortPrefixValid(String dev); private native boolean testRead(String dev, int type); Index: RXTXVersion.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXVersion.java,v retrieving revision 1.2.2.31 diff -u -r1.2.2.31 RXTXVersion.java --- RXTXVersion.java 16 Oct 2004 16:20:35 -0000 1.2.2.31 +++ RXTXVersion.java 7 Apr 2005 09:29:04 -0000 @@ -36,6 +36,7 @@ private static String Version; static { + System.loadLibrary( "rxtxSerial" ); Version = "RXTX-2.1-7pre20"; } /** @@ -47,4 +48,5 @@ { return(Version); } + public static native String nativeGetVersion(); } Index: SerialImp.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v retrieving revision 1.46.2.181 diff -u -r1.46.2.181 SerialImp.c --- SerialImp.c 17 Oct 2004 09:48:56 -0000 1.46.2.181 +++ SerialImp.c 7 Apr 2005 09:29:07 -0000 @@ -116,6 +116,7 @@ * It will eventually be removed. * */ #define RXTXPort(foo) Java_gnu_io_RXTXPort_ ## foo +#define RXTXVersion(foo) Java_gnu_io_RXTXVersion_ ## foo #define RXTXCommDriver(foo) Java_gnu_io_RXTXCommDriver_ ## foo #if defined(__sun__) || defined(__hpux__) @@ -4001,7 +4002,7 @@ } /*---------------------------------------------------------- -RXTXCommDriver.nativeGetVersion +RXTXVersion.nativeGetVersion accept: none perform: return the current version @@ -4010,9 +4011,10 @@ comments: This is used to avoid mixing versions of the .jar and native library. First introduced in rxtx-1.5-9 + Moved from RXTXCommDriver to RXTXVersion in rxtx-2.1-7 ----------------------------------------------------------*/ -JNIEXPORT jstring JNICALL RXTXCommDriver(nativeGetVersion) (JNIEnv *env, +JNIEXPORT jstring JNICALL RXTXVersion(nativeGetVersion) (JNIEnv *env, jclass jclazz ) { return (*env)->NewStringUTF( env, "RXTX-2.1-7pre20" ); From ricardo.trindade at emation.pt Thu Apr 7 03:45:58 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 10:45:58 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: <42550156.2040908@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050407/05212451/attachment-0019.html From thomas.shulok at lmco.com Thu Apr 7 17:43:11 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Thu, 07 Apr 2005 19:43:11 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi There, I'm attempting to talk RS232 between an embedded Linux box and a Windows box. Everything connects up fine, and I can send and receive a simple sequence of bytes with no problems. However, if around 5 seconds goes by without me sending something, I get the following when I attempt to send. java.io.IOException: Input/output error in writeArray Stack trace: java/lang/Throwable.()V java/lang/Throwable.(Ljava/lang/String;)V java/io/IOException.(Ljava/lang/String;)V gnu/io/RXTXPort.writeArray([BIIZ)V gnu/io/RXTXPort$SerialOutputStream.write([B)V SerialTest.main([Ljava/lang/String;)V If there interval is shorter (say 2 seconds between sends), I have no problems. On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and librxtxSerial-2.0.7pre2.so. Any ideas? Thanks, Thom -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5b23dcf/attachment-0019.html From taj at www.linux.org.uk Thu Apr 7 19:22:36 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:22:36 +0100 (BST) Subject: [Rxtx] Input/output error in writeArray In-Reply-To: References: Message-ID: On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a Windows > box. Everything connects up fine, and I can send and receive a simple > sequence of bytes with no problems. However, if around 5 seconds goes > by without me sending something, I get the following when I attempt to > send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Apr 7 19:24:59 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:24:59 +0100 (BST) Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) Message-ID: hmm. This would not work from applets would it? -- Trent Jarvi taj at www.linux.org.uk ---------- Forwarded message ---------- Date: Thu, 07 Apr 2005 16:05:53 -0400 From: Chris Gaffney To: taj at www.linux.org.uk Subject: RXTX Libraries on Classpath fix Hi, I submitted a patch for RXTX a few weeks ago to allow for loading the native libraries from the classpath. Since sending it to you I found it wasn't working on windows. I've fixed the problem and created a new patch that should replace the older one. The actual change is a one line from a String.equals() to a String.startsWith(). Thanks for a great piece of software, -Chris Gaffney Grand Valley State University -------------- next part -------------- A non-text attachment was scrubbed... Name: libraries_on_classpath_fixed.patch Type: text/x-patch Size: 5617 bytes Desc: Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5d423b8/libraries_on_classpath_fixed-0019.bin From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From thomas.shulok at lmco.com Fri Apr 8 10:38:55 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Fri, 08 Apr 2005 12:38:55 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi Trent, Thanks for the prompt response. Before diving deeper, I was wondering if there is a timeout parameter somewhere in the stack that I have not set properly. Given the nature of the failure (only fails if the line has been idle for a few seconds), it feels like some kind of timeout issue... Thanks again, Thom -----Original Message----- From: rxtx-bounces at mail.linuxgrrls.org [mailto:rxtx-bounces at mail.linuxgrrls.org] On Behalf Of Trent Jarvi Sent: Thursday, April 07, 2005 6:23 PM To: Java RXTX discussion Subject: Re: [Rxtx] Input/output error in writeArray On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a > Windows box. Everything connects up fine, and I can send and receive > a simple sequence of bytes with no problems. However, if around 5 > seconds goes by without me sending something, I get the following when > I attempt to send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at mail.linuxgrrls.org http://mail.linuxgrrls.org/mailman/listinfo/rxtx From ricardo.trindade at emation.pt Mon Apr 4 09:17:23 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Mon, 04 Apr 2005 16:17:23 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot Message-ID: <42515A83.4050907@emation.pt> Hi, I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most recent stable snapshot), and get the following exception : It looks like rxtx has been compiled with jdk 1.5. If this was indeed the case, I think there is a compilation flag that generates code that runs on older jdks. java.lang.UnsupportedClassVersionError: gnu/io/UnsupportedCommOperationException (Unsupported major.minor version 49.0) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at java.net.URLClassLoader.defineClass(URLClassLoader.java:251) at java.net.URLClassLoader.access$100(URLClassLoader.java:55) at java.net.URLClassLoader$1.run(URLClassLoader.java:194) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:187) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:141) I'm trying to run it with 1.4. thanks Ricardo From taj at www.linux.org.uk Tue Apr 5 00:48:12 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 07:48:12 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42515A83.4050907@emation.pt> References: <42515A83.4050907@emation.pt> Message-ID: On Mon, 4 Apr 2005, Ricardo Trindade wrote: > Hi, > > I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most > recent stable snapshot), and get the following exception : > > It looks like rxtx has been compiled with jdk 1.5. If this was > indeed the case, I think there is a compilation flag that generates code > that runs on older jdks. > > java.lang.UnsupportedClassVersionError: > gnu/io/UnsupportedCommOperationException (Unsupported major.minor > version 49.0) [snip] Thanks Ricardo I recompiled the jar with javac -source 1.3 -target 1.3. That should cover most of the JRE's in use today. I also compiled the rxtx 2.0 x86_64 native library which appeared to be missing. I tried looking for flags to pass gcc 4.0 to make the native libraries more backwards compatible but only found options for C++ which is not used in rxtx. I've got a list of other bugs that I'll be going through in the next few weeks but for now I just left them with the same CVS filename - no code changes. ftp://ftp.qbang.org/pub/rxtx/rxtx-2.0-CVS-20050120-bins.tar.gz ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-CVS-20050120-bins.tar.gz -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Tue Apr 5 02:24:33 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 05 Apr 2005 09:24:33 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: References: <42515A83.4050907@emation.pt> Message-ID: <42524B41.3040300@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050405/5919abbb/attachment-0020.html From taj at www.linux.org.uk Tue Apr 5 03:00:29 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 10:00:29 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42524B41.3040300@emation.pt> References: <42515A83.4050907@emation.pt> <42524B41.3040300@emation.pt> Message-ID: On Tue, 5 Apr 2005, Ricardo Trindade wrote: > Will you anounce to the list when a new release is available ? > There will be several incremental releases announced here. Once those are done, we will release 2.1.7 and 2.0.7. -- Trent Jarvi taj at www.linux.org.uk From no_spam at somewhere.com Tue Apr 5 11:55:37 2005 From: no_spam at somewhere.com (no_spam@somewhere.com) Date: Tue, 5 Apr 2005 13:55:37 -0400 Subject: [Rxtx] Closing a port from an event listener results in a deadlock Message-ID: <20050405175537.GA21747@rcog.homelinux.net> On the message I sent on March 14, does anyone had the chance to try the modification? Or was it already fixed? (I haven't searched the archive extensively) Or maybe my message got catched by some spam filters? (it made it to the list archive though) Anyway, I would appreciate some feedback (through the list) Thanks From taj at www.linux.org.uk Tue Apr 5 14:42:28 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 21:42:28 +0100 (BST) Subject: [Rxtx] Closing a port from an event listener results in a deadlock In-Reply-To: <20050405175537.GA21747@rcog.homelinux.net> References: <20050405175537.GA21747@rcog.homelinux.net> Message-ID: On Tue, 5 Apr 2005 no_spam at somewhere.com wrote: > On the message I sent on March 14, does anyone had the chance to try the > modification? > > Or was it already fixed? (I haven't searched the archive extensively) > > Or maybe my message got catched by some spam filters? (it made it to the list > archive though) > > Anyway, I would appreciate some feedback (through the list) > The patch is here http://marc.theaimsgroup.com/?l=rxtx&m=111084488820288&w=2 I have applied this patch to a local copy but will not be doing formal testing for a couple weeks. I do not try to close ports from inside the eventListenter usually so I encourage any feedback also. If there are no problems reported, I expect this will go into rxtx 2.1-7. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Wed Apr 6 08:33:42 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Wed, 06 Apr 2005 15:33:42 +0100 Subject: [Rxtx] getting RXTX version Message-ID: <4253F346.50102@emation.pt> Hi, I want to make sure my deployments have the same version of RXTX jar and native lib. I know the version of the jar can be obtained in the Version class, but how can I obtain the native version ? I know RXTX prints to the console a warning if the version is different. Is there a way to programatically know is this is the case ? I would like to log that to our app's log thanks Ricardo From taj at www.linux.org.uk Wed Apr 6 15:10:20 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 6 Apr 2005 22:10:20 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4253F346.50102@emation.pt> References: <4253F346.50102@emation.pt> Message-ID: On Wed, 6 Apr 2005, Ricardo Trindade wrote: > Hi, > > I want to make sure my deployments have the same version of RXTX jar > and native lib. > > I know the version of the jar can be obtained in the Version class, > but how can I obtain the native version ? > > I know RXTX prints to the console a warning if the version is > different. Is there a way to programatically know is this is the case ? > > I would like to log that to our app's log > There isn't a suggested way of doing that right now. We could move things around and have a static String RXTXVersion.getNativeVersion() in future releases. Is this what you expected? This is not documented in commapi at all. I just tossed that in to catch conflicts while developing. It would be nice to have access in GUI applications though. It may be possible to access RXTXCommDriver.LibVersion right now. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Thu Apr 7 02:51:00 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 09:51:00 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> Message-ID: <4254F474.7020905@emation.pt> >There isn't a suggested way of doing that right now. We could move things >around and have a static String RXTXVersion.getNativeVersion() in future >releases. Is this what you expected? > > Yes, that would be perfect. >This is not documented in commapi at all. I just tossed that in to catch >conflicts while developing. It would be nice to have access in GUI >applications though. > >It may be possible to access RXTXCommDriver.LibVersion right now. > > > I tried, and I don't think it's possible. From taj at www.linux.org.uk Thu Apr 7 03:32:04 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 7 Apr 2005 10:32:04 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4254F474.7020905@emation.pt> References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: On Thu, 7 Apr 2005, Ricardo Trindade wrote: > > >There isn't a suggested way of doing that right now. We could move things > >around and have a static String RXTXVersion.getNativeVersion() in future > >releases. Is this what you expected? > > > > > > Yes, that would be perfect. > The attached should do what you want. You will still need to catch an exception for older versions... -- Trent Jarvi taj at www.linux.org.uk -------------- next part -------------- ? public_version.patch Index: RXTXCommDriver.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXCommDriver.java,v retrieving revision 1.16.2.51 diff -u -r1.16.2.51 RXTXCommDriver.java --- RXTXCommDriver.java 12 Oct 2004 09:13:30 -0000 1.16.2.51 +++ RXTXCommDriver.java 7 Apr 2005 09:29:04 -0000 @@ -54,7 +54,7 @@ the Library. */ String JarVersion = RXTXVersion.getVersion(); - String LibVersion = nativeGetVersion(); + String LibVersion = RXTXVersion.nativeGetVersion(); if ( devel ) { System.out.println("Devel Library"); @@ -76,7 +76,6 @@ /** Get the Serial port prefixes for the running OS */ private String deviceDirectory; private String osName; - private static native String nativeGetVersion(); private native boolean registerKnownPorts(int PortType); private native boolean isPortPrefixValid(String dev); private native boolean testRead(String dev, int type); Index: RXTXVersion.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXVersion.java,v retrieving revision 1.2.2.31 diff -u -r1.2.2.31 RXTXVersion.java --- RXTXVersion.java 16 Oct 2004 16:20:35 -0000 1.2.2.31 +++ RXTXVersion.java 7 Apr 2005 09:29:04 -0000 @@ -36,6 +36,7 @@ private static String Version; static { + System.loadLibrary( "rxtxSerial" ); Version = "RXTX-2.1-7pre20"; } /** @@ -47,4 +48,5 @@ { return(Version); } + public static native String nativeGetVersion(); } Index: SerialImp.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v retrieving revision 1.46.2.181 diff -u -r1.46.2.181 SerialImp.c --- SerialImp.c 17 Oct 2004 09:48:56 -0000 1.46.2.181 +++ SerialImp.c 7 Apr 2005 09:29:07 -0000 @@ -116,6 +116,7 @@ * It will eventually be removed. * */ #define RXTXPort(foo) Java_gnu_io_RXTXPort_ ## foo +#define RXTXVersion(foo) Java_gnu_io_RXTXVersion_ ## foo #define RXTXCommDriver(foo) Java_gnu_io_RXTXCommDriver_ ## foo #if defined(__sun__) || defined(__hpux__) @@ -4001,7 +4002,7 @@ } /*---------------------------------------------------------- -RXTXCommDriver.nativeGetVersion +RXTXVersion.nativeGetVersion accept: none perform: return the current version @@ -4010,9 +4011,10 @@ comments: This is used to avoid mixing versions of the .jar and native library. First introduced in rxtx-1.5-9 + Moved from RXTXCommDriver to RXTXVersion in rxtx-2.1-7 ----------------------------------------------------------*/ -JNIEXPORT jstring JNICALL RXTXCommDriver(nativeGetVersion) (JNIEnv *env, +JNIEXPORT jstring JNICALL RXTXVersion(nativeGetVersion) (JNIEnv *env, jclass jclazz ) { return (*env)->NewStringUTF( env, "RXTX-2.1-7pre20" ); From ricardo.trindade at emation.pt Thu Apr 7 03:45:58 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 10:45:58 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: <42550156.2040908@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050407/05212451/attachment-0020.html From thomas.shulok at lmco.com Thu Apr 7 17:43:11 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Thu, 07 Apr 2005 19:43:11 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi There, I'm attempting to talk RS232 between an embedded Linux box and a Windows box. Everything connects up fine, and I can send and receive a simple sequence of bytes with no problems. However, if around 5 seconds goes by without me sending something, I get the following when I attempt to send. java.io.IOException: Input/output error in writeArray Stack trace: java/lang/Throwable.()V java/lang/Throwable.(Ljava/lang/String;)V java/io/IOException.(Ljava/lang/String;)V gnu/io/RXTXPort.writeArray([BIIZ)V gnu/io/RXTXPort$SerialOutputStream.write([B)V SerialTest.main([Ljava/lang/String;)V If there interval is shorter (say 2 seconds between sends), I have no problems. On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and librxtxSerial-2.0.7pre2.so. Any ideas? Thanks, Thom -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5b23dcf/attachment-0020.html From taj at www.linux.org.uk Thu Apr 7 19:22:36 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:22:36 +0100 (BST) Subject: [Rxtx] Input/output error in writeArray In-Reply-To: References: Message-ID: On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a Windows > box. Everything connects up fine, and I can send and receive a simple > sequence of bytes with no problems. However, if around 5 seconds goes > by without me sending something, I get the following when I attempt to > send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Apr 7 19:24:59 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:24:59 +0100 (BST) Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) Message-ID: hmm. This would not work from applets would it? -- Trent Jarvi taj at www.linux.org.uk ---------- Forwarded message ---------- Date: Thu, 07 Apr 2005 16:05:53 -0400 From: Chris Gaffney To: taj at www.linux.org.uk Subject: RXTX Libraries on Classpath fix Hi, I submitted a patch for RXTX a few weeks ago to allow for loading the native libraries from the classpath. Since sending it to you I found it wasn't working on windows. I've fixed the problem and created a new patch that should replace the older one. The actual change is a one line from a String.equals() to a String.startsWith(). Thanks for a great piece of software, -Chris Gaffney Grand Valley State University -------------- next part -------------- A non-text attachment was scrubbed... Name: libraries_on_classpath_fixed.patch Type: text/x-patch Size: 5617 bytes Desc: Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5d423b8/libraries_on_classpath_fixed-0020.bin From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From thomas.shulok at lmco.com Fri Apr 8 10:38:55 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Fri, 08 Apr 2005 12:38:55 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi Trent, Thanks for the prompt response. Before diving deeper, I was wondering if there is a timeout parameter somewhere in the stack that I have not set properly. Given the nature of the failure (only fails if the line has been idle for a few seconds), it feels like some kind of timeout issue... Thanks again, Thom -----Original Message----- From: rxtx-bounces at mail.linuxgrrls.org [mailto:rxtx-bounces at mail.linuxgrrls.org] On Behalf Of Trent Jarvi Sent: Thursday, April 07, 2005 6:23 PM To: Java RXTX discussion Subject: Re: [Rxtx] Input/output error in writeArray On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a > Windows box. Everything connects up fine, and I can send and receive > a simple sequence of bytes with no problems. However, if around 5 > seconds goes by without me sending something, I get the following when > I attempt to send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at mail.linuxgrrls.org http://mail.linuxgrrls.org/mailman/listinfo/rxtx From ricardo.trindade at emation.pt Mon Apr 4 09:17:23 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Mon, 04 Apr 2005 16:17:23 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot Message-ID: <42515A83.4050907@emation.pt> Hi, I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most recent stable snapshot), and get the following exception : It looks like rxtx has been compiled with jdk 1.5. If this was indeed the case, I think there is a compilation flag that generates code that runs on older jdks. java.lang.UnsupportedClassVersionError: gnu/io/UnsupportedCommOperationException (Unsupported major.minor version 49.0) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at java.net.URLClassLoader.defineClass(URLClassLoader.java:251) at java.net.URLClassLoader.access$100(URLClassLoader.java:55) at java.net.URLClassLoader$1.run(URLClassLoader.java:194) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:187) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:141) I'm trying to run it with 1.4. thanks Ricardo From taj at www.linux.org.uk Tue Apr 5 00:48:12 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 07:48:12 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42515A83.4050907@emation.pt> References: <42515A83.4050907@emation.pt> Message-ID: On Mon, 4 Apr 2005, Ricardo Trindade wrote: > Hi, > > I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most > recent stable snapshot), and get the following exception : > > It looks like rxtx has been compiled with jdk 1.5. If this was > indeed the case, I think there is a compilation flag that generates code > that runs on older jdks. > > java.lang.UnsupportedClassVersionError: > gnu/io/UnsupportedCommOperationException (Unsupported major.minor > version 49.0) [snip] Thanks Ricardo I recompiled the jar with javac -source 1.3 -target 1.3. That should cover most of the JRE's in use today. I also compiled the rxtx 2.0 x86_64 native library which appeared to be missing. I tried looking for flags to pass gcc 4.0 to make the native libraries more backwards compatible but only found options for C++ which is not used in rxtx. I've got a list of other bugs that I'll be going through in the next few weeks but for now I just left them with the same CVS filename - no code changes. ftp://ftp.qbang.org/pub/rxtx/rxtx-2.0-CVS-20050120-bins.tar.gz ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-CVS-20050120-bins.tar.gz -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Tue Apr 5 02:24:33 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 05 Apr 2005 09:24:33 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: References: <42515A83.4050907@emation.pt> Message-ID: <42524B41.3040300@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050405/5919abbb/attachment-0021.html From taj at www.linux.org.uk Tue Apr 5 03:00:29 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 10:00:29 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42524B41.3040300@emation.pt> References: <42515A83.4050907@emation.pt> <42524B41.3040300@emation.pt> Message-ID: On Tue, 5 Apr 2005, Ricardo Trindade wrote: > Will you anounce to the list when a new release is available ? > There will be several incremental releases announced here. Once those are done, we will release 2.1.7 and 2.0.7. -- Trent Jarvi taj at www.linux.org.uk From no_spam at somewhere.com Tue Apr 5 11:55:37 2005 From: no_spam at somewhere.com (no_spam@somewhere.com) Date: Tue, 5 Apr 2005 13:55:37 -0400 Subject: [Rxtx] Closing a port from an event listener results in a deadlock Message-ID: <20050405175537.GA21747@rcog.homelinux.net> On the message I sent on March 14, does anyone had the chance to try the modification? Or was it already fixed? (I haven't searched the archive extensively) Or maybe my message got catched by some spam filters? (it made it to the list archive though) Anyway, I would appreciate some feedback (through the list) Thanks From taj at www.linux.org.uk Tue Apr 5 14:42:28 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 21:42:28 +0100 (BST) Subject: [Rxtx] Closing a port from an event listener results in a deadlock In-Reply-To: <20050405175537.GA21747@rcog.homelinux.net> References: <20050405175537.GA21747@rcog.homelinux.net> Message-ID: On Tue, 5 Apr 2005 no_spam at somewhere.com wrote: > On the message I sent on March 14, does anyone had the chance to try the > modification? > > Or was it already fixed? (I haven't searched the archive extensively) > > Or maybe my message got catched by some spam filters? (it made it to the list > archive though) > > Anyway, I would appreciate some feedback (through the list) > The patch is here http://marc.theaimsgroup.com/?l=rxtx&m=111084488820288&w=2 I have applied this patch to a local copy but will not be doing formal testing for a couple weeks. I do not try to close ports from inside the eventListenter usually so I encourage any feedback also. If there are no problems reported, I expect this will go into rxtx 2.1-7. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Wed Apr 6 08:33:42 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Wed, 06 Apr 2005 15:33:42 +0100 Subject: [Rxtx] getting RXTX version Message-ID: <4253F346.50102@emation.pt> Hi, I want to make sure my deployments have the same version of RXTX jar and native lib. I know the version of the jar can be obtained in the Version class, but how can I obtain the native version ? I know RXTX prints to the console a warning if the version is different. Is there a way to programatically know is this is the case ? I would like to log that to our app's log thanks Ricardo From taj at www.linux.org.uk Wed Apr 6 15:10:20 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 6 Apr 2005 22:10:20 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4253F346.50102@emation.pt> References: <4253F346.50102@emation.pt> Message-ID: On Wed, 6 Apr 2005, Ricardo Trindade wrote: > Hi, > > I want to make sure my deployments have the same version of RXTX jar > and native lib. > > I know the version of the jar can be obtained in the Version class, > but how can I obtain the native version ? > > I know RXTX prints to the console a warning if the version is > different. Is there a way to programatically know is this is the case ? > > I would like to log that to our app's log > There isn't a suggested way of doing that right now. We could move things around and have a static String RXTXVersion.getNativeVersion() in future releases. Is this what you expected? This is not documented in commapi at all. I just tossed that in to catch conflicts while developing. It would be nice to have access in GUI applications though. It may be possible to access RXTXCommDriver.LibVersion right now. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Thu Apr 7 02:51:00 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 09:51:00 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> Message-ID: <4254F474.7020905@emation.pt> >There isn't a suggested way of doing that right now. We could move things >around and have a static String RXTXVersion.getNativeVersion() in future >releases. Is this what you expected? > > Yes, that would be perfect. >This is not documented in commapi at all. I just tossed that in to catch >conflicts while developing. It would be nice to have access in GUI >applications though. > >It may be possible to access RXTXCommDriver.LibVersion right now. > > > I tried, and I don't think it's possible. From taj at www.linux.org.uk Thu Apr 7 03:32:04 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 7 Apr 2005 10:32:04 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4254F474.7020905@emation.pt> References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: On Thu, 7 Apr 2005, Ricardo Trindade wrote: > > >There isn't a suggested way of doing that right now. We could move things > >around and have a static String RXTXVersion.getNativeVersion() in future > >releases. Is this what you expected? > > > > > > Yes, that would be perfect. > The attached should do what you want. You will still need to catch an exception for older versions... -- Trent Jarvi taj at www.linux.org.uk -------------- next part -------------- ? public_version.patch Index: RXTXCommDriver.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXCommDriver.java,v retrieving revision 1.16.2.51 diff -u -r1.16.2.51 RXTXCommDriver.java --- RXTXCommDriver.java 12 Oct 2004 09:13:30 -0000 1.16.2.51 +++ RXTXCommDriver.java 7 Apr 2005 09:29:04 -0000 @@ -54,7 +54,7 @@ the Library. */ String JarVersion = RXTXVersion.getVersion(); - String LibVersion = nativeGetVersion(); + String LibVersion = RXTXVersion.nativeGetVersion(); if ( devel ) { System.out.println("Devel Library"); @@ -76,7 +76,6 @@ /** Get the Serial port prefixes for the running OS */ private String deviceDirectory; private String osName; - private static native String nativeGetVersion(); private native boolean registerKnownPorts(int PortType); private native boolean isPortPrefixValid(String dev); private native boolean testRead(String dev, int type); Index: RXTXVersion.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXVersion.java,v retrieving revision 1.2.2.31 diff -u -r1.2.2.31 RXTXVersion.java --- RXTXVersion.java 16 Oct 2004 16:20:35 -0000 1.2.2.31 +++ RXTXVersion.java 7 Apr 2005 09:29:04 -0000 @@ -36,6 +36,7 @@ private static String Version; static { + System.loadLibrary( "rxtxSerial" ); Version = "RXTX-2.1-7pre20"; } /** @@ -47,4 +48,5 @@ { return(Version); } + public static native String nativeGetVersion(); } Index: SerialImp.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v retrieving revision 1.46.2.181 diff -u -r1.46.2.181 SerialImp.c --- SerialImp.c 17 Oct 2004 09:48:56 -0000 1.46.2.181 +++ SerialImp.c 7 Apr 2005 09:29:07 -0000 @@ -116,6 +116,7 @@ * It will eventually be removed. * */ #define RXTXPort(foo) Java_gnu_io_RXTXPort_ ## foo +#define RXTXVersion(foo) Java_gnu_io_RXTXVersion_ ## foo #define RXTXCommDriver(foo) Java_gnu_io_RXTXCommDriver_ ## foo #if defined(__sun__) || defined(__hpux__) @@ -4001,7 +4002,7 @@ } /*---------------------------------------------------------- -RXTXCommDriver.nativeGetVersion +RXTXVersion.nativeGetVersion accept: none perform: return the current version @@ -4010,9 +4011,10 @@ comments: This is used to avoid mixing versions of the .jar and native library. First introduced in rxtx-1.5-9 + Moved from RXTXCommDriver to RXTXVersion in rxtx-2.1-7 ----------------------------------------------------------*/ -JNIEXPORT jstring JNICALL RXTXCommDriver(nativeGetVersion) (JNIEnv *env, +JNIEXPORT jstring JNICALL RXTXVersion(nativeGetVersion) (JNIEnv *env, jclass jclazz ) { return (*env)->NewStringUTF( env, "RXTX-2.1-7pre20" ); From ricardo.trindade at emation.pt Thu Apr 7 03:45:58 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 10:45:58 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: <42550156.2040908@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050407/05212451/attachment-0021.html From thomas.shulok at lmco.com Thu Apr 7 17:43:11 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Thu, 07 Apr 2005 19:43:11 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi There, I'm attempting to talk RS232 between an embedded Linux box and a Windows box. Everything connects up fine, and I can send and receive a simple sequence of bytes with no problems. However, if around 5 seconds goes by without me sending something, I get the following when I attempt to send. java.io.IOException: Input/output error in writeArray Stack trace: java/lang/Throwable.()V java/lang/Throwable.(Ljava/lang/String;)V java/io/IOException.(Ljava/lang/String;)V gnu/io/RXTXPort.writeArray([BIIZ)V gnu/io/RXTXPort$SerialOutputStream.write([B)V SerialTest.main([Ljava/lang/String;)V If there interval is shorter (say 2 seconds between sends), I have no problems. On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and librxtxSerial-2.0.7pre2.so. Any ideas? Thanks, Thom -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5b23dcf/attachment-0021.html From taj at www.linux.org.uk Thu Apr 7 19:22:36 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:22:36 +0100 (BST) Subject: [Rxtx] Input/output error in writeArray In-Reply-To: References: Message-ID: On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a Windows > box. Everything connects up fine, and I can send and receive a simple > sequence of bytes with no problems. However, if around 5 seconds goes > by without me sending something, I get the following when I attempt to > send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Apr 7 19:24:59 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:24:59 +0100 (BST) Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) Message-ID: hmm. This would not work from applets would it? -- Trent Jarvi taj at www.linux.org.uk ---------- Forwarded message ---------- Date: Thu, 07 Apr 2005 16:05:53 -0400 From: Chris Gaffney To: taj at www.linux.org.uk Subject: RXTX Libraries on Classpath fix Hi, I submitted a patch for RXTX a few weeks ago to allow for loading the native libraries from the classpath. Since sending it to you I found it wasn't working on windows. I've fixed the problem and created a new patch that should replace the older one. The actual change is a one line from a String.equals() to a String.startsWith(). Thanks for a great piece of software, -Chris Gaffney Grand Valley State University -------------- next part -------------- A non-text attachment was scrubbed... Name: libraries_on_classpath_fixed.patch Type: text/x-patch Size: 5617 bytes Desc: Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5d423b8/libraries_on_classpath_fixed-0021.bin From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From thomas.shulok at lmco.com Fri Apr 8 10:38:55 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Fri, 08 Apr 2005 12:38:55 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi Trent, Thanks for the prompt response. Before diving deeper, I was wondering if there is a timeout parameter somewhere in the stack that I have not set properly. Given the nature of the failure (only fails if the line has been idle for a few seconds), it feels like some kind of timeout issue... Thanks again, Thom -----Original Message----- From: rxtx-bounces at mail.linuxgrrls.org [mailto:rxtx-bounces at mail.linuxgrrls.org] On Behalf Of Trent Jarvi Sent: Thursday, April 07, 2005 6:23 PM To: Java RXTX discussion Subject: Re: [Rxtx] Input/output error in writeArray On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a > Windows box. Everything connects up fine, and I can send and receive > a simple sequence of bytes with no problems. However, if around 5 > seconds goes by without me sending something, I get the following when > I attempt to send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at mail.linuxgrrls.org http://mail.linuxgrrls.org/mailman/listinfo/rxtx From ricardo.trindade at emation.pt Mon Apr 4 09:17:23 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Mon, 04 Apr 2005 16:17:23 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot Message-ID: <42515A83.4050907@emation.pt> Hi, I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most recent stable snapshot), and get the following exception : It looks like rxtx has been compiled with jdk 1.5. If this was indeed the case, I think there is a compilation flag that generates code that runs on older jdks. java.lang.UnsupportedClassVersionError: gnu/io/UnsupportedCommOperationException (Unsupported major.minor version 49.0) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at java.net.URLClassLoader.defineClass(URLClassLoader.java:251) at java.net.URLClassLoader.access$100(URLClassLoader.java:55) at java.net.URLClassLoader$1.run(URLClassLoader.java:194) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:187) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:141) I'm trying to run it with 1.4. thanks Ricardo From taj at www.linux.org.uk Tue Apr 5 00:48:12 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 07:48:12 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42515A83.4050907@emation.pt> References: <42515A83.4050907@emation.pt> Message-ID: On Mon, 4 Apr 2005, Ricardo Trindade wrote: > Hi, > > I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most > recent stable snapshot), and get the following exception : > > It looks like rxtx has been compiled with jdk 1.5. If this was > indeed the case, I think there is a compilation flag that generates code > that runs on older jdks. > > java.lang.UnsupportedClassVersionError: > gnu/io/UnsupportedCommOperationException (Unsupported major.minor > version 49.0) [snip] Thanks Ricardo I recompiled the jar with javac -source 1.3 -target 1.3. That should cover most of the JRE's in use today. I also compiled the rxtx 2.0 x86_64 native library which appeared to be missing. I tried looking for flags to pass gcc 4.0 to make the native libraries more backwards compatible but only found options for C++ which is not used in rxtx. I've got a list of other bugs that I'll be going through in the next few weeks but for now I just left them with the same CVS filename - no code changes. ftp://ftp.qbang.org/pub/rxtx/rxtx-2.0-CVS-20050120-bins.tar.gz ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-CVS-20050120-bins.tar.gz -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Tue Apr 5 02:24:33 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 05 Apr 2005 09:24:33 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: References: <42515A83.4050907@emation.pt> Message-ID: <42524B41.3040300@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050405/5919abbb/attachment-0022.html From taj at www.linux.org.uk Tue Apr 5 03:00:29 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 10:00:29 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42524B41.3040300@emation.pt> References: <42515A83.4050907@emation.pt> <42524B41.3040300@emation.pt> Message-ID: On Tue, 5 Apr 2005, Ricardo Trindade wrote: > Will you anounce to the list when a new release is available ? > There will be several incremental releases announced here. Once those are done, we will release 2.1.7 and 2.0.7. -- Trent Jarvi taj at www.linux.org.uk From no_spam at somewhere.com Tue Apr 5 11:55:37 2005 From: no_spam at somewhere.com (no_spam@somewhere.com) Date: Tue, 5 Apr 2005 13:55:37 -0400 Subject: [Rxtx] Closing a port from an event listener results in a deadlock Message-ID: <20050405175537.GA21747@rcog.homelinux.net> On the message I sent on March 14, does anyone had the chance to try the modification? Or was it already fixed? (I haven't searched the archive extensively) Or maybe my message got catched by some spam filters? (it made it to the list archive though) Anyway, I would appreciate some feedback (through the list) Thanks From taj at www.linux.org.uk Tue Apr 5 14:42:28 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 21:42:28 +0100 (BST) Subject: [Rxtx] Closing a port from an event listener results in a deadlock In-Reply-To: <20050405175537.GA21747@rcog.homelinux.net> References: <20050405175537.GA21747@rcog.homelinux.net> Message-ID: On Tue, 5 Apr 2005 no_spam at somewhere.com wrote: > On the message I sent on March 14, does anyone had the chance to try the > modification? > > Or was it already fixed? (I haven't searched the archive extensively) > > Or maybe my message got catched by some spam filters? (it made it to the list > archive though) > > Anyway, I would appreciate some feedback (through the list) > The patch is here http://marc.theaimsgroup.com/?l=rxtx&m=111084488820288&w=2 I have applied this patch to a local copy but will not be doing formal testing for a couple weeks. I do not try to close ports from inside the eventListenter usually so I encourage any feedback also. If there are no problems reported, I expect this will go into rxtx 2.1-7. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Wed Apr 6 08:33:42 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Wed, 06 Apr 2005 15:33:42 +0100 Subject: [Rxtx] getting RXTX version Message-ID: <4253F346.50102@emation.pt> Hi, I want to make sure my deployments have the same version of RXTX jar and native lib. I know the version of the jar can be obtained in the Version class, but how can I obtain the native version ? I know RXTX prints to the console a warning if the version is different. Is there a way to programatically know is this is the case ? I would like to log that to our app's log thanks Ricardo From taj at www.linux.org.uk Wed Apr 6 15:10:20 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 6 Apr 2005 22:10:20 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4253F346.50102@emation.pt> References: <4253F346.50102@emation.pt> Message-ID: On Wed, 6 Apr 2005, Ricardo Trindade wrote: > Hi, > > I want to make sure my deployments have the same version of RXTX jar > and native lib. > > I know the version of the jar can be obtained in the Version class, > but how can I obtain the native version ? > > I know RXTX prints to the console a warning if the version is > different. Is there a way to programatically know is this is the case ? > > I would like to log that to our app's log > There isn't a suggested way of doing that right now. We could move things around and have a static String RXTXVersion.getNativeVersion() in future releases. Is this what you expected? This is not documented in commapi at all. I just tossed that in to catch conflicts while developing. It would be nice to have access in GUI applications though. It may be possible to access RXTXCommDriver.LibVersion right now. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Thu Apr 7 02:51:00 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 09:51:00 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> Message-ID: <4254F474.7020905@emation.pt> >There isn't a suggested way of doing that right now. We could move things >around and have a static String RXTXVersion.getNativeVersion() in future >releases. Is this what you expected? > > Yes, that would be perfect. >This is not documented in commapi at all. I just tossed that in to catch >conflicts while developing. It would be nice to have access in GUI >applications though. > >It may be possible to access RXTXCommDriver.LibVersion right now. > > > I tried, and I don't think it's possible. From taj at www.linux.org.uk Thu Apr 7 03:32:04 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 7 Apr 2005 10:32:04 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4254F474.7020905@emation.pt> References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: On Thu, 7 Apr 2005, Ricardo Trindade wrote: > > >There isn't a suggested way of doing that right now. We could move things > >around and have a static String RXTXVersion.getNativeVersion() in future > >releases. Is this what you expected? > > > > > > Yes, that would be perfect. > The attached should do what you want. You will still need to catch an exception for older versions... -- Trent Jarvi taj at www.linux.org.uk -------------- next part -------------- ? public_version.patch Index: RXTXCommDriver.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXCommDriver.java,v retrieving revision 1.16.2.51 diff -u -r1.16.2.51 RXTXCommDriver.java --- RXTXCommDriver.java 12 Oct 2004 09:13:30 -0000 1.16.2.51 +++ RXTXCommDriver.java 7 Apr 2005 09:29:04 -0000 @@ -54,7 +54,7 @@ the Library. */ String JarVersion = RXTXVersion.getVersion(); - String LibVersion = nativeGetVersion(); + String LibVersion = RXTXVersion.nativeGetVersion(); if ( devel ) { System.out.println("Devel Library"); @@ -76,7 +76,6 @@ /** Get the Serial port prefixes for the running OS */ private String deviceDirectory; private String osName; - private static native String nativeGetVersion(); private native boolean registerKnownPorts(int PortType); private native boolean isPortPrefixValid(String dev); private native boolean testRead(String dev, int type); Index: RXTXVersion.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXVersion.java,v retrieving revision 1.2.2.31 diff -u -r1.2.2.31 RXTXVersion.java --- RXTXVersion.java 16 Oct 2004 16:20:35 -0000 1.2.2.31 +++ RXTXVersion.java 7 Apr 2005 09:29:04 -0000 @@ -36,6 +36,7 @@ private static String Version; static { + System.loadLibrary( "rxtxSerial" ); Version = "RXTX-2.1-7pre20"; } /** @@ -47,4 +48,5 @@ { return(Version); } + public static native String nativeGetVersion(); } Index: SerialImp.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v retrieving revision 1.46.2.181 diff -u -r1.46.2.181 SerialImp.c --- SerialImp.c 17 Oct 2004 09:48:56 -0000 1.46.2.181 +++ SerialImp.c 7 Apr 2005 09:29:07 -0000 @@ -116,6 +116,7 @@ * It will eventually be removed. * */ #define RXTXPort(foo) Java_gnu_io_RXTXPort_ ## foo +#define RXTXVersion(foo) Java_gnu_io_RXTXVersion_ ## foo #define RXTXCommDriver(foo) Java_gnu_io_RXTXCommDriver_ ## foo #if defined(__sun__) || defined(__hpux__) @@ -4001,7 +4002,7 @@ } /*---------------------------------------------------------- -RXTXCommDriver.nativeGetVersion +RXTXVersion.nativeGetVersion accept: none perform: return the current version @@ -4010,9 +4011,10 @@ comments: This is used to avoid mixing versions of the .jar and native library. First introduced in rxtx-1.5-9 + Moved from RXTXCommDriver to RXTXVersion in rxtx-2.1-7 ----------------------------------------------------------*/ -JNIEXPORT jstring JNICALL RXTXCommDriver(nativeGetVersion) (JNIEnv *env, +JNIEXPORT jstring JNICALL RXTXVersion(nativeGetVersion) (JNIEnv *env, jclass jclazz ) { return (*env)->NewStringUTF( env, "RXTX-2.1-7pre20" ); From ricardo.trindade at emation.pt Thu Apr 7 03:45:58 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 10:45:58 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: <42550156.2040908@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050407/05212451/attachment-0022.html From thomas.shulok at lmco.com Thu Apr 7 17:43:11 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Thu, 07 Apr 2005 19:43:11 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi There, I'm attempting to talk RS232 between an embedded Linux box and a Windows box. Everything connects up fine, and I can send and receive a simple sequence of bytes with no problems. However, if around 5 seconds goes by without me sending something, I get the following when I attempt to send. java.io.IOException: Input/output error in writeArray Stack trace: java/lang/Throwable.()V java/lang/Throwable.(Ljava/lang/String;)V java/io/IOException.(Ljava/lang/String;)V gnu/io/RXTXPort.writeArray([BIIZ)V gnu/io/RXTXPort$SerialOutputStream.write([B)V SerialTest.main([Ljava/lang/String;)V If there interval is shorter (say 2 seconds between sends), I have no problems. On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and librxtxSerial-2.0.7pre2.so. Any ideas? Thanks, Thom -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5b23dcf/attachment-0022.html From taj at www.linux.org.uk Thu Apr 7 19:22:36 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:22:36 +0100 (BST) Subject: [Rxtx] Input/output error in writeArray In-Reply-To: References: Message-ID: On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a Windows > box. Everything connects up fine, and I can send and receive a simple > sequence of bytes with no problems. However, if around 5 seconds goes > by without me sending something, I get the following when I attempt to > send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Apr 7 19:24:59 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:24:59 +0100 (BST) Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) Message-ID: hmm. This would not work from applets would it? -- Trent Jarvi taj at www.linux.org.uk ---------- Forwarded message ---------- Date: Thu, 07 Apr 2005 16:05:53 -0400 From: Chris Gaffney To: taj at www.linux.org.uk Subject: RXTX Libraries on Classpath fix Hi, I submitted a patch for RXTX a few weeks ago to allow for loading the native libraries from the classpath. Since sending it to you I found it wasn't working on windows. I've fixed the problem and created a new patch that should replace the older one. The actual change is a one line from a String.equals() to a String.startsWith(). Thanks for a great piece of software, -Chris Gaffney Grand Valley State University -------------- next part -------------- A non-text attachment was scrubbed... Name: libraries_on_classpath_fixed.patch Type: text/x-patch Size: 5617 bytes Desc: Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5d423b8/libraries_on_classpath_fixed-0022.bin From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From thomas.shulok at lmco.com Fri Apr 8 10:38:55 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Fri, 08 Apr 2005 12:38:55 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi Trent, Thanks for the prompt response. Before diving deeper, I was wondering if there is a timeout parameter somewhere in the stack that I have not set properly. Given the nature of the failure (only fails if the line has been idle for a few seconds), it feels like some kind of timeout issue... Thanks again, Thom -----Original Message----- From: rxtx-bounces at mail.linuxgrrls.org [mailto:rxtx-bounces at mail.linuxgrrls.org] On Behalf Of Trent Jarvi Sent: Thursday, April 07, 2005 6:23 PM To: Java RXTX discussion Subject: Re: [Rxtx] Input/output error in writeArray On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a > Windows box. Everything connects up fine, and I can send and receive > a simple sequence of bytes with no problems. However, if around 5 > seconds goes by without me sending something, I get the following when > I attempt to send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at mail.linuxgrrls.org http://mail.linuxgrrls.org/mailman/listinfo/rxtx From ricardo.trindade at emation.pt Mon Apr 4 09:17:23 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Mon, 04 Apr 2005 16:17:23 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot Message-ID: <42515A83.4050907@emation.pt> Hi, I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most recent stable snapshot), and get the following exception : It looks like rxtx has been compiled with jdk 1.5. If this was indeed the case, I think there is a compilation flag that generates code that runs on older jdks. java.lang.UnsupportedClassVersionError: gnu/io/UnsupportedCommOperationException (Unsupported major.minor version 49.0) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at java.net.URLClassLoader.defineClass(URLClassLoader.java:251) at java.net.URLClassLoader.access$100(URLClassLoader.java:55) at java.net.URLClassLoader$1.run(URLClassLoader.java:194) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:187) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:141) I'm trying to run it with 1.4. thanks Ricardo From taj at www.linux.org.uk Tue Apr 5 00:48:12 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 07:48:12 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42515A83.4050907@emation.pt> References: <42515A83.4050907@emation.pt> Message-ID: On Mon, 4 Apr 2005, Ricardo Trindade wrote: > Hi, > > I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most > recent stable snapshot), and get the following exception : > > It looks like rxtx has been compiled with jdk 1.5. If this was > indeed the case, I think there is a compilation flag that generates code > that runs on older jdks. > > java.lang.UnsupportedClassVersionError: > gnu/io/UnsupportedCommOperationException (Unsupported major.minor > version 49.0) [snip] Thanks Ricardo I recompiled the jar with javac -source 1.3 -target 1.3. That should cover most of the JRE's in use today. I also compiled the rxtx 2.0 x86_64 native library which appeared to be missing. I tried looking for flags to pass gcc 4.0 to make the native libraries more backwards compatible but only found options for C++ which is not used in rxtx. I've got a list of other bugs that I'll be going through in the next few weeks but for now I just left them with the same CVS filename - no code changes. ftp://ftp.qbang.org/pub/rxtx/rxtx-2.0-CVS-20050120-bins.tar.gz ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-CVS-20050120-bins.tar.gz -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Tue Apr 5 02:24:33 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 05 Apr 2005 09:24:33 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: References: <42515A83.4050907@emation.pt> Message-ID: <42524B41.3040300@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050405/5919abbb/attachment-0023.html From taj at www.linux.org.uk Tue Apr 5 03:00:29 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 10:00:29 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42524B41.3040300@emation.pt> References: <42515A83.4050907@emation.pt> <42524B41.3040300@emation.pt> Message-ID: On Tue, 5 Apr 2005, Ricardo Trindade wrote: > Will you anounce to the list when a new release is available ? > There will be several incremental releases announced here. Once those are done, we will release 2.1.7 and 2.0.7. -- Trent Jarvi taj at www.linux.org.uk From no_spam at somewhere.com Tue Apr 5 11:55:37 2005 From: no_spam at somewhere.com (no_spam@somewhere.com) Date: Tue, 5 Apr 2005 13:55:37 -0400 Subject: [Rxtx] Closing a port from an event listener results in a deadlock Message-ID: <20050405175537.GA21747@rcog.homelinux.net> On the message I sent on March 14, does anyone had the chance to try the modification? Or was it already fixed? (I haven't searched the archive extensively) Or maybe my message got catched by some spam filters? (it made it to the list archive though) Anyway, I would appreciate some feedback (through the list) Thanks From taj at www.linux.org.uk Tue Apr 5 14:42:28 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 21:42:28 +0100 (BST) Subject: [Rxtx] Closing a port from an event listener results in a deadlock In-Reply-To: <20050405175537.GA21747@rcog.homelinux.net> References: <20050405175537.GA21747@rcog.homelinux.net> Message-ID: On Tue, 5 Apr 2005 no_spam at somewhere.com wrote: > On the message I sent on March 14, does anyone had the chance to try the > modification? > > Or was it already fixed? (I haven't searched the archive extensively) > > Or maybe my message got catched by some spam filters? (it made it to the list > archive though) > > Anyway, I would appreciate some feedback (through the list) > The patch is here http://marc.theaimsgroup.com/?l=rxtx&m=111084488820288&w=2 I have applied this patch to a local copy but will not be doing formal testing for a couple weeks. I do not try to close ports from inside the eventListenter usually so I encourage any feedback also. If there are no problems reported, I expect this will go into rxtx 2.1-7. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Wed Apr 6 08:33:42 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Wed, 06 Apr 2005 15:33:42 +0100 Subject: [Rxtx] getting RXTX version Message-ID: <4253F346.50102@emation.pt> Hi, I want to make sure my deployments have the same version of RXTX jar and native lib. I know the version of the jar can be obtained in the Version class, but how can I obtain the native version ? I know RXTX prints to the console a warning if the version is different. Is there a way to programatically know is this is the case ? I would like to log that to our app's log thanks Ricardo From taj at www.linux.org.uk Wed Apr 6 15:10:20 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 6 Apr 2005 22:10:20 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4253F346.50102@emation.pt> References: <4253F346.50102@emation.pt> Message-ID: On Wed, 6 Apr 2005, Ricardo Trindade wrote: > Hi, > > I want to make sure my deployments have the same version of RXTX jar > and native lib. > > I know the version of the jar can be obtained in the Version class, > but how can I obtain the native version ? > > I know RXTX prints to the console a warning if the version is > different. Is there a way to programatically know is this is the case ? > > I would like to log that to our app's log > There isn't a suggested way of doing that right now. We could move things around and have a static String RXTXVersion.getNativeVersion() in future releases. Is this what you expected? This is not documented in commapi at all. I just tossed that in to catch conflicts while developing. It would be nice to have access in GUI applications though. It may be possible to access RXTXCommDriver.LibVersion right now. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Thu Apr 7 02:51:00 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 09:51:00 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> Message-ID: <4254F474.7020905@emation.pt> >There isn't a suggested way of doing that right now. We could move things >around and have a static String RXTXVersion.getNativeVersion() in future >releases. Is this what you expected? > > Yes, that would be perfect. >This is not documented in commapi at all. I just tossed that in to catch >conflicts while developing. It would be nice to have access in GUI >applications though. > >It may be possible to access RXTXCommDriver.LibVersion right now. > > > I tried, and I don't think it's possible. From taj at www.linux.org.uk Thu Apr 7 03:32:04 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 7 Apr 2005 10:32:04 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4254F474.7020905@emation.pt> References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: On Thu, 7 Apr 2005, Ricardo Trindade wrote: > > >There isn't a suggested way of doing that right now. We could move things > >around and have a static String RXTXVersion.getNativeVersion() in future > >releases. Is this what you expected? > > > > > > Yes, that would be perfect. > The attached should do what you want. You will still need to catch an exception for older versions... -- Trent Jarvi taj at www.linux.org.uk -------------- next part -------------- ? public_version.patch Index: RXTXCommDriver.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXCommDriver.java,v retrieving revision 1.16.2.51 diff -u -r1.16.2.51 RXTXCommDriver.java --- RXTXCommDriver.java 12 Oct 2004 09:13:30 -0000 1.16.2.51 +++ RXTXCommDriver.java 7 Apr 2005 09:29:04 -0000 @@ -54,7 +54,7 @@ the Library. */ String JarVersion = RXTXVersion.getVersion(); - String LibVersion = nativeGetVersion(); + String LibVersion = RXTXVersion.nativeGetVersion(); if ( devel ) { System.out.println("Devel Library"); @@ -76,7 +76,6 @@ /** Get the Serial port prefixes for the running OS */ private String deviceDirectory; private String osName; - private static native String nativeGetVersion(); private native boolean registerKnownPorts(int PortType); private native boolean isPortPrefixValid(String dev); private native boolean testRead(String dev, int type); Index: RXTXVersion.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXVersion.java,v retrieving revision 1.2.2.31 diff -u -r1.2.2.31 RXTXVersion.java --- RXTXVersion.java 16 Oct 2004 16:20:35 -0000 1.2.2.31 +++ RXTXVersion.java 7 Apr 2005 09:29:04 -0000 @@ -36,6 +36,7 @@ private static String Version; static { + System.loadLibrary( "rxtxSerial" ); Version = "RXTX-2.1-7pre20"; } /** @@ -47,4 +48,5 @@ { return(Version); } + public static native String nativeGetVersion(); } Index: SerialImp.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v retrieving revision 1.46.2.181 diff -u -r1.46.2.181 SerialImp.c --- SerialImp.c 17 Oct 2004 09:48:56 -0000 1.46.2.181 +++ SerialImp.c 7 Apr 2005 09:29:07 -0000 @@ -116,6 +116,7 @@ * It will eventually be removed. * */ #define RXTXPort(foo) Java_gnu_io_RXTXPort_ ## foo +#define RXTXVersion(foo) Java_gnu_io_RXTXVersion_ ## foo #define RXTXCommDriver(foo) Java_gnu_io_RXTXCommDriver_ ## foo #if defined(__sun__) || defined(__hpux__) @@ -4001,7 +4002,7 @@ } /*---------------------------------------------------------- -RXTXCommDriver.nativeGetVersion +RXTXVersion.nativeGetVersion accept: none perform: return the current version @@ -4010,9 +4011,10 @@ comments: This is used to avoid mixing versions of the .jar and native library. First introduced in rxtx-1.5-9 + Moved from RXTXCommDriver to RXTXVersion in rxtx-2.1-7 ----------------------------------------------------------*/ -JNIEXPORT jstring JNICALL RXTXCommDriver(nativeGetVersion) (JNIEnv *env, +JNIEXPORT jstring JNICALL RXTXVersion(nativeGetVersion) (JNIEnv *env, jclass jclazz ) { return (*env)->NewStringUTF( env, "RXTX-2.1-7pre20" ); From ricardo.trindade at emation.pt Thu Apr 7 03:45:58 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 10:45:58 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: <42550156.2040908@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050407/05212451/attachment-0023.html From thomas.shulok at lmco.com Thu Apr 7 17:43:11 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Thu, 07 Apr 2005 19:43:11 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi There, I'm attempting to talk RS232 between an embedded Linux box and a Windows box. Everything connects up fine, and I can send and receive a simple sequence of bytes with no problems. However, if around 5 seconds goes by without me sending something, I get the following when I attempt to send. java.io.IOException: Input/output error in writeArray Stack trace: java/lang/Throwable.()V java/lang/Throwable.(Ljava/lang/String;)V java/io/IOException.(Ljava/lang/String;)V gnu/io/RXTXPort.writeArray([BIIZ)V gnu/io/RXTXPort$SerialOutputStream.write([B)V SerialTest.main([Ljava/lang/String;)V If there interval is shorter (say 2 seconds between sends), I have no problems. On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and librxtxSerial-2.0.7pre2.so. Any ideas? Thanks, Thom -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5b23dcf/attachment-0023.html From taj at www.linux.org.uk Thu Apr 7 19:22:36 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:22:36 +0100 (BST) Subject: [Rxtx] Input/output error in writeArray In-Reply-To: References: Message-ID: On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a Windows > box. Everything connects up fine, and I can send and receive a simple > sequence of bytes with no problems. However, if around 5 seconds goes > by without me sending something, I get the following when I attempt to > send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Apr 7 19:24:59 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:24:59 +0100 (BST) Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) Message-ID: hmm. This would not work from applets would it? -- Trent Jarvi taj at www.linux.org.uk ---------- Forwarded message ---------- Date: Thu, 07 Apr 2005 16:05:53 -0400 From: Chris Gaffney To: taj at www.linux.org.uk Subject: RXTX Libraries on Classpath fix Hi, I submitted a patch for RXTX a few weeks ago to allow for loading the native libraries from the classpath. Since sending it to you I found it wasn't working on windows. I've fixed the problem and created a new patch that should replace the older one. The actual change is a one line from a String.equals() to a String.startsWith(). Thanks for a great piece of software, -Chris Gaffney Grand Valley State University -------------- next part -------------- A non-text attachment was scrubbed... Name: libraries_on_classpath_fixed.patch Type: text/x-patch Size: 5617 bytes Desc: Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5d423b8/libraries_on_classpath_fixed-0023.bin From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From thomas.shulok at lmco.com Fri Apr 8 10:38:55 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Fri, 08 Apr 2005 12:38:55 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi Trent, Thanks for the prompt response. Before diving deeper, I was wondering if there is a timeout parameter somewhere in the stack that I have not set properly. Given the nature of the failure (only fails if the line has been idle for a few seconds), it feels like some kind of timeout issue... Thanks again, Thom -----Original Message----- From: rxtx-bounces at mail.linuxgrrls.org [mailto:rxtx-bounces at mail.linuxgrrls.org] On Behalf Of Trent Jarvi Sent: Thursday, April 07, 2005 6:23 PM To: Java RXTX discussion Subject: Re: [Rxtx] Input/output error in writeArray On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a > Windows box. Everything connects up fine, and I can send and receive > a simple sequence of bytes with no problems. However, if around 5 > seconds goes by without me sending something, I get the following when > I attempt to send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at mail.linuxgrrls.org http://mail.linuxgrrls.org/mailman/listinfo/rxtx From ricardo.trindade at emation.pt Mon Apr 4 09:17:23 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Mon, 04 Apr 2005 16:17:23 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot Message-ID: <42515A83.4050907@emation.pt> Hi, I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most recent stable snapshot), and get the following exception : It looks like rxtx has been compiled with jdk 1.5. If this was indeed the case, I think there is a compilation flag that generates code that runs on older jdks. java.lang.UnsupportedClassVersionError: gnu/io/UnsupportedCommOperationException (Unsupported major.minor version 49.0) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at java.net.URLClassLoader.defineClass(URLClassLoader.java:251) at java.net.URLClassLoader.access$100(URLClassLoader.java:55) at java.net.URLClassLoader$1.run(URLClassLoader.java:194) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:187) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:141) I'm trying to run it with 1.4. thanks Ricardo From taj at www.linux.org.uk Tue Apr 5 00:48:12 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 07:48:12 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42515A83.4050907@emation.pt> References: <42515A83.4050907@emation.pt> Message-ID: On Mon, 4 Apr 2005, Ricardo Trindade wrote: > Hi, > > I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most > recent stable snapshot), and get the following exception : > > It looks like rxtx has been compiled with jdk 1.5. If this was > indeed the case, I think there is a compilation flag that generates code > that runs on older jdks. > > java.lang.UnsupportedClassVersionError: > gnu/io/UnsupportedCommOperationException (Unsupported major.minor > version 49.0) [snip] Thanks Ricardo I recompiled the jar with javac -source 1.3 -target 1.3. That should cover most of the JRE's in use today. I also compiled the rxtx 2.0 x86_64 native library which appeared to be missing. I tried looking for flags to pass gcc 4.0 to make the native libraries more backwards compatible but only found options for C++ which is not used in rxtx. I've got a list of other bugs that I'll be going through in the next few weeks but for now I just left them with the same CVS filename - no code changes. ftp://ftp.qbang.org/pub/rxtx/rxtx-2.0-CVS-20050120-bins.tar.gz ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-CVS-20050120-bins.tar.gz -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Tue Apr 5 02:24:33 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 05 Apr 2005 09:24:33 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: References: <42515A83.4050907@emation.pt> Message-ID: <42524B41.3040300@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050405/5919abbb/attachment-0024.html From taj at www.linux.org.uk Tue Apr 5 03:00:29 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 10:00:29 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42524B41.3040300@emation.pt> References: <42515A83.4050907@emation.pt> <42524B41.3040300@emation.pt> Message-ID: On Tue, 5 Apr 2005, Ricardo Trindade wrote: > Will you anounce to the list when a new release is available ? > There will be several incremental releases announced here. Once those are done, we will release 2.1.7 and 2.0.7. -- Trent Jarvi taj at www.linux.org.uk From no_spam at somewhere.com Tue Apr 5 11:55:37 2005 From: no_spam at somewhere.com (no_spam@somewhere.com) Date: Tue, 5 Apr 2005 13:55:37 -0400 Subject: [Rxtx] Closing a port from an event listener results in a deadlock Message-ID: <20050405175537.GA21747@rcog.homelinux.net> On the message I sent on March 14, does anyone had the chance to try the modification? Or was it already fixed? (I haven't searched the archive extensively) Or maybe my message got catched by some spam filters? (it made it to the list archive though) Anyway, I would appreciate some feedback (through the list) Thanks From taj at www.linux.org.uk Tue Apr 5 14:42:28 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 21:42:28 +0100 (BST) Subject: [Rxtx] Closing a port from an event listener results in a deadlock In-Reply-To: <20050405175537.GA21747@rcog.homelinux.net> References: <20050405175537.GA21747@rcog.homelinux.net> Message-ID: On Tue, 5 Apr 2005 no_spam at somewhere.com wrote: > On the message I sent on March 14, does anyone had the chance to try the > modification? > > Or was it already fixed? (I haven't searched the archive extensively) > > Or maybe my message got catched by some spam filters? (it made it to the list > archive though) > > Anyway, I would appreciate some feedback (through the list) > The patch is here http://marc.theaimsgroup.com/?l=rxtx&m=111084488820288&w=2 I have applied this patch to a local copy but will not be doing formal testing for a couple weeks. I do not try to close ports from inside the eventListenter usually so I encourage any feedback also. If there are no problems reported, I expect this will go into rxtx 2.1-7. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Wed Apr 6 08:33:42 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Wed, 06 Apr 2005 15:33:42 +0100 Subject: [Rxtx] getting RXTX version Message-ID: <4253F346.50102@emation.pt> Hi, I want to make sure my deployments have the same version of RXTX jar and native lib. I know the version of the jar can be obtained in the Version class, but how can I obtain the native version ? I know RXTX prints to the console a warning if the version is different. Is there a way to programatically know is this is the case ? I would like to log that to our app's log thanks Ricardo From taj at www.linux.org.uk Wed Apr 6 15:10:20 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 6 Apr 2005 22:10:20 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4253F346.50102@emation.pt> References: <4253F346.50102@emation.pt> Message-ID: On Wed, 6 Apr 2005, Ricardo Trindade wrote: > Hi, > > I want to make sure my deployments have the same version of RXTX jar > and native lib. > > I know the version of the jar can be obtained in the Version class, > but how can I obtain the native version ? > > I know RXTX prints to the console a warning if the version is > different. Is there a way to programatically know is this is the case ? > > I would like to log that to our app's log > There isn't a suggested way of doing that right now. We could move things around and have a static String RXTXVersion.getNativeVersion() in future releases. Is this what you expected? This is not documented in commapi at all. I just tossed that in to catch conflicts while developing. It would be nice to have access in GUI applications though. It may be possible to access RXTXCommDriver.LibVersion right now. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Thu Apr 7 02:51:00 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 09:51:00 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> Message-ID: <4254F474.7020905@emation.pt> >There isn't a suggested way of doing that right now. We could move things >around and have a static String RXTXVersion.getNativeVersion() in future >releases. Is this what you expected? > > Yes, that would be perfect. >This is not documented in commapi at all. I just tossed that in to catch >conflicts while developing. It would be nice to have access in GUI >applications though. > >It may be possible to access RXTXCommDriver.LibVersion right now. > > > I tried, and I don't think it's possible. From taj at www.linux.org.uk Thu Apr 7 03:32:04 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 7 Apr 2005 10:32:04 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4254F474.7020905@emation.pt> References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: On Thu, 7 Apr 2005, Ricardo Trindade wrote: > > >There isn't a suggested way of doing that right now. We could move things > >around and have a static String RXTXVersion.getNativeVersion() in future > >releases. Is this what you expected? > > > > > > Yes, that would be perfect. > The attached should do what you want. You will still need to catch an exception for older versions... -- Trent Jarvi taj at www.linux.org.uk -------------- next part -------------- ? public_version.patch Index: RXTXCommDriver.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXCommDriver.java,v retrieving revision 1.16.2.51 diff -u -r1.16.2.51 RXTXCommDriver.java --- RXTXCommDriver.java 12 Oct 2004 09:13:30 -0000 1.16.2.51 +++ RXTXCommDriver.java 7 Apr 2005 09:29:04 -0000 @@ -54,7 +54,7 @@ the Library. */ String JarVersion = RXTXVersion.getVersion(); - String LibVersion = nativeGetVersion(); + String LibVersion = RXTXVersion.nativeGetVersion(); if ( devel ) { System.out.println("Devel Library"); @@ -76,7 +76,6 @@ /** Get the Serial port prefixes for the running OS */ private String deviceDirectory; private String osName; - private static native String nativeGetVersion(); private native boolean registerKnownPorts(int PortType); private native boolean isPortPrefixValid(String dev); private native boolean testRead(String dev, int type); Index: RXTXVersion.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXVersion.java,v retrieving revision 1.2.2.31 diff -u -r1.2.2.31 RXTXVersion.java --- RXTXVersion.java 16 Oct 2004 16:20:35 -0000 1.2.2.31 +++ RXTXVersion.java 7 Apr 2005 09:29:04 -0000 @@ -36,6 +36,7 @@ private static String Version; static { + System.loadLibrary( "rxtxSerial" ); Version = "RXTX-2.1-7pre20"; } /** @@ -47,4 +48,5 @@ { return(Version); } + public static native String nativeGetVersion(); } Index: SerialImp.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v retrieving revision 1.46.2.181 diff -u -r1.46.2.181 SerialImp.c --- SerialImp.c 17 Oct 2004 09:48:56 -0000 1.46.2.181 +++ SerialImp.c 7 Apr 2005 09:29:07 -0000 @@ -116,6 +116,7 @@ * It will eventually be removed. * */ #define RXTXPort(foo) Java_gnu_io_RXTXPort_ ## foo +#define RXTXVersion(foo) Java_gnu_io_RXTXVersion_ ## foo #define RXTXCommDriver(foo) Java_gnu_io_RXTXCommDriver_ ## foo #if defined(__sun__) || defined(__hpux__) @@ -4001,7 +4002,7 @@ } /*---------------------------------------------------------- -RXTXCommDriver.nativeGetVersion +RXTXVersion.nativeGetVersion accept: none perform: return the current version @@ -4010,9 +4011,10 @@ comments: This is used to avoid mixing versions of the .jar and native library. First introduced in rxtx-1.5-9 + Moved from RXTXCommDriver to RXTXVersion in rxtx-2.1-7 ----------------------------------------------------------*/ -JNIEXPORT jstring JNICALL RXTXCommDriver(nativeGetVersion) (JNIEnv *env, +JNIEXPORT jstring JNICALL RXTXVersion(nativeGetVersion) (JNIEnv *env, jclass jclazz ) { return (*env)->NewStringUTF( env, "RXTX-2.1-7pre20" ); From ricardo.trindade at emation.pt Thu Apr 7 03:45:58 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 10:45:58 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: <42550156.2040908@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050407/05212451/attachment-0024.html From thomas.shulok at lmco.com Thu Apr 7 17:43:11 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Thu, 07 Apr 2005 19:43:11 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi There, I'm attempting to talk RS232 between an embedded Linux box and a Windows box. Everything connects up fine, and I can send and receive a simple sequence of bytes with no problems. However, if around 5 seconds goes by without me sending something, I get the following when I attempt to send. java.io.IOException: Input/output error in writeArray Stack trace: java/lang/Throwable.()V java/lang/Throwable.(Ljava/lang/String;)V java/io/IOException.(Ljava/lang/String;)V gnu/io/RXTXPort.writeArray([BIIZ)V gnu/io/RXTXPort$SerialOutputStream.write([B)V SerialTest.main([Ljava/lang/String;)V If there interval is shorter (say 2 seconds between sends), I have no problems. On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and librxtxSerial-2.0.7pre2.so. Any ideas? Thanks, Thom -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5b23dcf/attachment-0024.html From taj at www.linux.org.uk Thu Apr 7 19:22:36 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:22:36 +0100 (BST) Subject: [Rxtx] Input/output error in writeArray In-Reply-To: References: Message-ID: On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a Windows > box. Everything connects up fine, and I can send and receive a simple > sequence of bytes with no problems. However, if around 5 seconds goes > by without me sending something, I get the following when I attempt to > send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Apr 7 19:24:59 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:24:59 +0100 (BST) Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) Message-ID: hmm. This would not work from applets would it? -- Trent Jarvi taj at www.linux.org.uk ---------- Forwarded message ---------- Date: Thu, 07 Apr 2005 16:05:53 -0400 From: Chris Gaffney To: taj at www.linux.org.uk Subject: RXTX Libraries on Classpath fix Hi, I submitted a patch for RXTX a few weeks ago to allow for loading the native libraries from the classpath. Since sending it to you I found it wasn't working on windows. I've fixed the problem and created a new patch that should replace the older one. The actual change is a one line from a String.equals() to a String.startsWith(). Thanks for a great piece of software, -Chris Gaffney Grand Valley State University -------------- next part -------------- A non-text attachment was scrubbed... Name: libraries_on_classpath_fixed.patch Type: text/x-patch Size: 5617 bytes Desc: Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5d423b8/libraries_on_classpath_fixed-0024.bin From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From thomas.shulok at lmco.com Fri Apr 8 10:38:55 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Fri, 08 Apr 2005 12:38:55 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi Trent, Thanks for the prompt response. Before diving deeper, I was wondering if there is a timeout parameter somewhere in the stack that I have not set properly. Given the nature of the failure (only fails if the line has been idle for a few seconds), it feels like some kind of timeout issue... Thanks again, Thom -----Original Message----- From: rxtx-bounces at mail.linuxgrrls.org [mailto:rxtx-bounces at mail.linuxgrrls.org] On Behalf Of Trent Jarvi Sent: Thursday, April 07, 2005 6:23 PM To: Java RXTX discussion Subject: Re: [Rxtx] Input/output error in writeArray On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a > Windows box. Everything connects up fine, and I can send and receive > a simple sequence of bytes with no problems. However, if around 5 > seconds goes by without me sending something, I get the following when > I attempt to send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at mail.linuxgrrls.org http://mail.linuxgrrls.org/mailman/listinfo/rxtx From ricardo.trindade at emation.pt Mon Apr 4 09:17:23 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Mon, 04 Apr 2005 16:17:23 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot Message-ID: <42515A83.4050907@emation.pt> Hi, I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most recent stable snapshot), and get the following exception : It looks like rxtx has been compiled with jdk 1.5. If this was indeed the case, I think there is a compilation flag that generates code that runs on older jdks. java.lang.UnsupportedClassVersionError: gnu/io/UnsupportedCommOperationException (Unsupported major.minor version 49.0) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at java.net.URLClassLoader.defineClass(URLClassLoader.java:251) at java.net.URLClassLoader.access$100(URLClassLoader.java:55) at java.net.URLClassLoader$1.run(URLClassLoader.java:194) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:187) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:141) I'm trying to run it with 1.4. thanks Ricardo From taj at www.linux.org.uk Tue Apr 5 00:48:12 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 07:48:12 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42515A83.4050907@emation.pt> References: <42515A83.4050907@emation.pt> Message-ID: On Mon, 4 Apr 2005, Ricardo Trindade wrote: > Hi, > > I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most > recent stable snapshot), and get the following exception : > > It looks like rxtx has been compiled with jdk 1.5. If this was > indeed the case, I think there is a compilation flag that generates code > that runs on older jdks. > > java.lang.UnsupportedClassVersionError: > gnu/io/UnsupportedCommOperationException (Unsupported major.minor > version 49.0) [snip] Thanks Ricardo I recompiled the jar with javac -source 1.3 -target 1.3. That should cover most of the JRE's in use today. I also compiled the rxtx 2.0 x86_64 native library which appeared to be missing. I tried looking for flags to pass gcc 4.0 to make the native libraries more backwards compatible but only found options for C++ which is not used in rxtx. I've got a list of other bugs that I'll be going through in the next few weeks but for now I just left them with the same CVS filename - no code changes. ftp://ftp.qbang.org/pub/rxtx/rxtx-2.0-CVS-20050120-bins.tar.gz ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-CVS-20050120-bins.tar.gz -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Tue Apr 5 02:24:33 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 05 Apr 2005 09:24:33 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: References: <42515A83.4050907@emation.pt> Message-ID: <42524B41.3040300@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050405/5919abbb/attachment-0025.html From taj at www.linux.org.uk Tue Apr 5 03:00:29 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 10:00:29 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42524B41.3040300@emation.pt> References: <42515A83.4050907@emation.pt> <42524B41.3040300@emation.pt> Message-ID: On Tue, 5 Apr 2005, Ricardo Trindade wrote: > Will you anounce to the list when a new release is available ? > There will be several incremental releases announced here. Once those are done, we will release 2.1.7 and 2.0.7. -- Trent Jarvi taj at www.linux.org.uk From no_spam at somewhere.com Tue Apr 5 11:55:37 2005 From: no_spam at somewhere.com (no_spam@somewhere.com) Date: Tue, 5 Apr 2005 13:55:37 -0400 Subject: [Rxtx] Closing a port from an event listener results in a deadlock Message-ID: <20050405175537.GA21747@rcog.homelinux.net> On the message I sent on March 14, does anyone had the chance to try the modification? Or was it already fixed? (I haven't searched the archive extensively) Or maybe my message got catched by some spam filters? (it made it to the list archive though) Anyway, I would appreciate some feedback (through the list) Thanks From taj at www.linux.org.uk Tue Apr 5 14:42:28 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 21:42:28 +0100 (BST) Subject: [Rxtx] Closing a port from an event listener results in a deadlock In-Reply-To: <20050405175537.GA21747@rcog.homelinux.net> References: <20050405175537.GA21747@rcog.homelinux.net> Message-ID: On Tue, 5 Apr 2005 no_spam at somewhere.com wrote: > On the message I sent on March 14, does anyone had the chance to try the > modification? > > Or was it already fixed? (I haven't searched the archive extensively) > > Or maybe my message got catched by some spam filters? (it made it to the list > archive though) > > Anyway, I would appreciate some feedback (through the list) > The patch is here http://marc.theaimsgroup.com/?l=rxtx&m=111084488820288&w=2 I have applied this patch to a local copy but will not be doing formal testing for a couple weeks. I do not try to close ports from inside the eventListenter usually so I encourage any feedback also. If there are no problems reported, I expect this will go into rxtx 2.1-7. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Wed Apr 6 08:33:42 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Wed, 06 Apr 2005 15:33:42 +0100 Subject: [Rxtx] getting RXTX version Message-ID: <4253F346.50102@emation.pt> Hi, I want to make sure my deployments have the same version of RXTX jar and native lib. I know the version of the jar can be obtained in the Version class, but how can I obtain the native version ? I know RXTX prints to the console a warning if the version is different. Is there a way to programatically know is this is the case ? I would like to log that to our app's log thanks Ricardo From taj at www.linux.org.uk Wed Apr 6 15:10:20 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 6 Apr 2005 22:10:20 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4253F346.50102@emation.pt> References: <4253F346.50102@emation.pt> Message-ID: On Wed, 6 Apr 2005, Ricardo Trindade wrote: > Hi, > > I want to make sure my deployments have the same version of RXTX jar > and native lib. > > I know the version of the jar can be obtained in the Version class, > but how can I obtain the native version ? > > I know RXTX prints to the console a warning if the version is > different. Is there a way to programatically know is this is the case ? > > I would like to log that to our app's log > There isn't a suggested way of doing that right now. We could move things around and have a static String RXTXVersion.getNativeVersion() in future releases. Is this what you expected? This is not documented in commapi at all. I just tossed that in to catch conflicts while developing. It would be nice to have access in GUI applications though. It may be possible to access RXTXCommDriver.LibVersion right now. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Thu Apr 7 02:51:00 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 09:51:00 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> Message-ID: <4254F474.7020905@emation.pt> >There isn't a suggested way of doing that right now. We could move things >around and have a static String RXTXVersion.getNativeVersion() in future >releases. Is this what you expected? > > Yes, that would be perfect. >This is not documented in commapi at all. I just tossed that in to catch >conflicts while developing. It would be nice to have access in GUI >applications though. > >It may be possible to access RXTXCommDriver.LibVersion right now. > > > I tried, and I don't think it's possible. From taj at www.linux.org.uk Thu Apr 7 03:32:04 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 7 Apr 2005 10:32:04 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4254F474.7020905@emation.pt> References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: On Thu, 7 Apr 2005, Ricardo Trindade wrote: > > >There isn't a suggested way of doing that right now. We could move things > >around and have a static String RXTXVersion.getNativeVersion() in future > >releases. Is this what you expected? > > > > > > Yes, that would be perfect. > The attached should do what you want. You will still need to catch an exception for older versions... -- Trent Jarvi taj at www.linux.org.uk -------------- next part -------------- ? public_version.patch Index: RXTXCommDriver.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXCommDriver.java,v retrieving revision 1.16.2.51 diff -u -r1.16.2.51 RXTXCommDriver.java --- RXTXCommDriver.java 12 Oct 2004 09:13:30 -0000 1.16.2.51 +++ RXTXCommDriver.java 7 Apr 2005 09:29:04 -0000 @@ -54,7 +54,7 @@ the Library. */ String JarVersion = RXTXVersion.getVersion(); - String LibVersion = nativeGetVersion(); + String LibVersion = RXTXVersion.nativeGetVersion(); if ( devel ) { System.out.println("Devel Library"); @@ -76,7 +76,6 @@ /** Get the Serial port prefixes for the running OS */ private String deviceDirectory; private String osName; - private static native String nativeGetVersion(); private native boolean registerKnownPorts(int PortType); private native boolean isPortPrefixValid(String dev); private native boolean testRead(String dev, int type); Index: RXTXVersion.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXVersion.java,v retrieving revision 1.2.2.31 diff -u -r1.2.2.31 RXTXVersion.java --- RXTXVersion.java 16 Oct 2004 16:20:35 -0000 1.2.2.31 +++ RXTXVersion.java 7 Apr 2005 09:29:04 -0000 @@ -36,6 +36,7 @@ private static String Version; static { + System.loadLibrary( "rxtxSerial" ); Version = "RXTX-2.1-7pre20"; } /** @@ -47,4 +48,5 @@ { return(Version); } + public static native String nativeGetVersion(); } Index: SerialImp.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v retrieving revision 1.46.2.181 diff -u -r1.46.2.181 SerialImp.c --- SerialImp.c 17 Oct 2004 09:48:56 -0000 1.46.2.181 +++ SerialImp.c 7 Apr 2005 09:29:07 -0000 @@ -116,6 +116,7 @@ * It will eventually be removed. * */ #define RXTXPort(foo) Java_gnu_io_RXTXPort_ ## foo +#define RXTXVersion(foo) Java_gnu_io_RXTXVersion_ ## foo #define RXTXCommDriver(foo) Java_gnu_io_RXTXCommDriver_ ## foo #if defined(__sun__) || defined(__hpux__) @@ -4001,7 +4002,7 @@ } /*---------------------------------------------------------- -RXTXCommDriver.nativeGetVersion +RXTXVersion.nativeGetVersion accept: none perform: return the current version @@ -4010,9 +4011,10 @@ comments: This is used to avoid mixing versions of the .jar and native library. First introduced in rxtx-1.5-9 + Moved from RXTXCommDriver to RXTXVersion in rxtx-2.1-7 ----------------------------------------------------------*/ -JNIEXPORT jstring JNICALL RXTXCommDriver(nativeGetVersion) (JNIEnv *env, +JNIEXPORT jstring JNICALL RXTXVersion(nativeGetVersion) (JNIEnv *env, jclass jclazz ) { return (*env)->NewStringUTF( env, "RXTX-2.1-7pre20" ); From ricardo.trindade at emation.pt Thu Apr 7 03:45:58 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 10:45:58 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: <42550156.2040908@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050407/05212451/attachment-0025.html From thomas.shulok at lmco.com Thu Apr 7 17:43:11 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Thu, 07 Apr 2005 19:43:11 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi There, I'm attempting to talk RS232 between an embedded Linux box and a Windows box. Everything connects up fine, and I can send and receive a simple sequence of bytes with no problems. However, if around 5 seconds goes by without me sending something, I get the following when I attempt to send. java.io.IOException: Input/output error in writeArray Stack trace: java/lang/Throwable.()V java/lang/Throwable.(Ljava/lang/String;)V java/io/IOException.(Ljava/lang/String;)V gnu/io/RXTXPort.writeArray([BIIZ)V gnu/io/RXTXPort$SerialOutputStream.write([B)V SerialTest.main([Ljava/lang/String;)V If there interval is shorter (say 2 seconds between sends), I have no problems. On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and librxtxSerial-2.0.7pre2.so. Any ideas? Thanks, Thom -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5b23dcf/attachment-0025.html From taj at www.linux.org.uk Thu Apr 7 19:22:36 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:22:36 +0100 (BST) Subject: [Rxtx] Input/output error in writeArray In-Reply-To: References: Message-ID: On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a Windows > box. Everything connects up fine, and I can send and receive a simple > sequence of bytes with no problems. However, if around 5 seconds goes > by without me sending something, I get the following when I attempt to > send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Apr 7 19:24:59 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:24:59 +0100 (BST) Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) Message-ID: hmm. This would not work from applets would it? -- Trent Jarvi taj at www.linux.org.uk ---------- Forwarded message ---------- Date: Thu, 07 Apr 2005 16:05:53 -0400 From: Chris Gaffney To: taj at www.linux.org.uk Subject: RXTX Libraries on Classpath fix Hi, I submitted a patch for RXTX a few weeks ago to allow for loading the native libraries from the classpath. Since sending it to you I found it wasn't working on windows. I've fixed the problem and created a new patch that should replace the older one. The actual change is a one line from a String.equals() to a String.startsWith(). Thanks for a great piece of software, -Chris Gaffney Grand Valley State University -------------- next part -------------- A non-text attachment was scrubbed... Name: libraries_on_classpath_fixed.patch Type: text/x-patch Size: 5617 bytes Desc: Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5d423b8/libraries_on_classpath_fixed-0025.bin From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From thomas.shulok at lmco.com Fri Apr 8 10:38:55 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Fri, 08 Apr 2005 12:38:55 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi Trent, Thanks for the prompt response. Before diving deeper, I was wondering if there is a timeout parameter somewhere in the stack that I have not set properly. Given the nature of the failure (only fails if the line has been idle for a few seconds), it feels like some kind of timeout issue... Thanks again, Thom -----Original Message----- From: rxtx-bounces at mail.linuxgrrls.org [mailto:rxtx-bounces at mail.linuxgrrls.org] On Behalf Of Trent Jarvi Sent: Thursday, April 07, 2005 6:23 PM To: Java RXTX discussion Subject: Re: [Rxtx] Input/output error in writeArray On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a > Windows box. Everything connects up fine, and I can send and receive > a simple sequence of bytes with no problems. However, if around 5 > seconds goes by without me sending something, I get the following when > I attempt to send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at mail.linuxgrrls.org http://mail.linuxgrrls.org/mailman/listinfo/rxtx From ricardo.trindade at emation.pt Mon Apr 4 09:17:23 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Mon, 04 Apr 2005 16:17:23 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot Message-ID: <42515A83.4050907@emation.pt> Hi, I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most recent stable snapshot), and get the following exception : It looks like rxtx has been compiled with jdk 1.5. If this was indeed the case, I think there is a compilation flag that generates code that runs on older jdks. java.lang.UnsupportedClassVersionError: gnu/io/UnsupportedCommOperationException (Unsupported major.minor version 49.0) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at java.net.URLClassLoader.defineClass(URLClassLoader.java:251) at java.net.URLClassLoader.access$100(URLClassLoader.java:55) at java.net.URLClassLoader$1.run(URLClassLoader.java:194) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:187) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:141) I'm trying to run it with 1.4. thanks Ricardo From taj at www.linux.org.uk Tue Apr 5 00:48:12 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 07:48:12 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42515A83.4050907@emation.pt> References: <42515A83.4050907@emation.pt> Message-ID: On Mon, 4 Apr 2005, Ricardo Trindade wrote: > Hi, > > I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most > recent stable snapshot), and get the following exception : > > It looks like rxtx has been compiled with jdk 1.5. If this was > indeed the case, I think there is a compilation flag that generates code > that runs on older jdks. > > java.lang.UnsupportedClassVersionError: > gnu/io/UnsupportedCommOperationException (Unsupported major.minor > version 49.0) [snip] Thanks Ricardo I recompiled the jar with javac -source 1.3 -target 1.3. That should cover most of the JRE's in use today. I also compiled the rxtx 2.0 x86_64 native library which appeared to be missing. I tried looking for flags to pass gcc 4.0 to make the native libraries more backwards compatible but only found options for C++ which is not used in rxtx. I've got a list of other bugs that I'll be going through in the next few weeks but for now I just left them with the same CVS filename - no code changes. ftp://ftp.qbang.org/pub/rxtx/rxtx-2.0-CVS-20050120-bins.tar.gz ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-CVS-20050120-bins.tar.gz -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Tue Apr 5 02:24:33 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 05 Apr 2005 09:24:33 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: References: <42515A83.4050907@emation.pt> Message-ID: <42524B41.3040300@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050405/5919abbb/attachment-0026.html From taj at www.linux.org.uk Tue Apr 5 03:00:29 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 10:00:29 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42524B41.3040300@emation.pt> References: <42515A83.4050907@emation.pt> <42524B41.3040300@emation.pt> Message-ID: On Tue, 5 Apr 2005, Ricardo Trindade wrote: > Will you anounce to the list when a new release is available ? > There will be several incremental releases announced here. Once those are done, we will release 2.1.7 and 2.0.7. -- Trent Jarvi taj at www.linux.org.uk From no_spam at somewhere.com Tue Apr 5 11:55:37 2005 From: no_spam at somewhere.com (no_spam@somewhere.com) Date: Tue, 5 Apr 2005 13:55:37 -0400 Subject: [Rxtx] Closing a port from an event listener results in a deadlock Message-ID: <20050405175537.GA21747@rcog.homelinux.net> On the message I sent on March 14, does anyone had the chance to try the modification? Or was it already fixed? (I haven't searched the archive extensively) Or maybe my message got catched by some spam filters? (it made it to the list archive though) Anyway, I would appreciate some feedback (through the list) Thanks From taj at www.linux.org.uk Tue Apr 5 14:42:28 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 21:42:28 +0100 (BST) Subject: [Rxtx] Closing a port from an event listener results in a deadlock In-Reply-To: <20050405175537.GA21747@rcog.homelinux.net> References: <20050405175537.GA21747@rcog.homelinux.net> Message-ID: On Tue, 5 Apr 2005 no_spam at somewhere.com wrote: > On the message I sent on March 14, does anyone had the chance to try the > modification? > > Or was it already fixed? (I haven't searched the archive extensively) > > Or maybe my message got catched by some spam filters? (it made it to the list > archive though) > > Anyway, I would appreciate some feedback (through the list) > The patch is here http://marc.theaimsgroup.com/?l=rxtx&m=111084488820288&w=2 I have applied this patch to a local copy but will not be doing formal testing for a couple weeks. I do not try to close ports from inside the eventListenter usually so I encourage any feedback also. If there are no problems reported, I expect this will go into rxtx 2.1-7. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Wed Apr 6 08:33:42 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Wed, 06 Apr 2005 15:33:42 +0100 Subject: [Rxtx] getting RXTX version Message-ID: <4253F346.50102@emation.pt> Hi, I want to make sure my deployments have the same version of RXTX jar and native lib. I know the version of the jar can be obtained in the Version class, but how can I obtain the native version ? I know RXTX prints to the console a warning if the version is different. Is there a way to programatically know is this is the case ? I would like to log that to our app's log thanks Ricardo From taj at www.linux.org.uk Wed Apr 6 15:10:20 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 6 Apr 2005 22:10:20 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4253F346.50102@emation.pt> References: <4253F346.50102@emation.pt> Message-ID: On Wed, 6 Apr 2005, Ricardo Trindade wrote: > Hi, > > I want to make sure my deployments have the same version of RXTX jar > and native lib. > > I know the version of the jar can be obtained in the Version class, > but how can I obtain the native version ? > > I know RXTX prints to the console a warning if the version is > different. Is there a way to programatically know is this is the case ? > > I would like to log that to our app's log > There isn't a suggested way of doing that right now. We could move things around and have a static String RXTXVersion.getNativeVersion() in future releases. Is this what you expected? This is not documented in commapi at all. I just tossed that in to catch conflicts while developing. It would be nice to have access in GUI applications though. It may be possible to access RXTXCommDriver.LibVersion right now. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Thu Apr 7 02:51:00 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 09:51:00 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> Message-ID: <4254F474.7020905@emation.pt> >There isn't a suggested way of doing that right now. We could move things >around and have a static String RXTXVersion.getNativeVersion() in future >releases. Is this what you expected? > > Yes, that would be perfect. >This is not documented in commapi at all. I just tossed that in to catch >conflicts while developing. It would be nice to have access in GUI >applications though. > >It may be possible to access RXTXCommDriver.LibVersion right now. > > > I tried, and I don't think it's possible. From taj at www.linux.org.uk Thu Apr 7 03:32:04 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 7 Apr 2005 10:32:04 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4254F474.7020905@emation.pt> References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: On Thu, 7 Apr 2005, Ricardo Trindade wrote: > > >There isn't a suggested way of doing that right now. We could move things > >around and have a static String RXTXVersion.getNativeVersion() in future > >releases. Is this what you expected? > > > > > > Yes, that would be perfect. > The attached should do what you want. You will still need to catch an exception for older versions... -- Trent Jarvi taj at www.linux.org.uk -------------- next part -------------- ? public_version.patch Index: RXTXCommDriver.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXCommDriver.java,v retrieving revision 1.16.2.51 diff -u -r1.16.2.51 RXTXCommDriver.java --- RXTXCommDriver.java 12 Oct 2004 09:13:30 -0000 1.16.2.51 +++ RXTXCommDriver.java 7 Apr 2005 09:29:04 -0000 @@ -54,7 +54,7 @@ the Library. */ String JarVersion = RXTXVersion.getVersion(); - String LibVersion = nativeGetVersion(); + String LibVersion = RXTXVersion.nativeGetVersion(); if ( devel ) { System.out.println("Devel Library"); @@ -76,7 +76,6 @@ /** Get the Serial port prefixes for the running OS */ private String deviceDirectory; private String osName; - private static native String nativeGetVersion(); private native boolean registerKnownPorts(int PortType); private native boolean isPortPrefixValid(String dev); private native boolean testRead(String dev, int type); Index: RXTXVersion.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXVersion.java,v retrieving revision 1.2.2.31 diff -u -r1.2.2.31 RXTXVersion.java --- RXTXVersion.java 16 Oct 2004 16:20:35 -0000 1.2.2.31 +++ RXTXVersion.java 7 Apr 2005 09:29:04 -0000 @@ -36,6 +36,7 @@ private static String Version; static { + System.loadLibrary( "rxtxSerial" ); Version = "RXTX-2.1-7pre20"; } /** @@ -47,4 +48,5 @@ { return(Version); } + public static native String nativeGetVersion(); } Index: SerialImp.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v retrieving revision 1.46.2.181 diff -u -r1.46.2.181 SerialImp.c --- SerialImp.c 17 Oct 2004 09:48:56 -0000 1.46.2.181 +++ SerialImp.c 7 Apr 2005 09:29:07 -0000 @@ -116,6 +116,7 @@ * It will eventually be removed. * */ #define RXTXPort(foo) Java_gnu_io_RXTXPort_ ## foo +#define RXTXVersion(foo) Java_gnu_io_RXTXVersion_ ## foo #define RXTXCommDriver(foo) Java_gnu_io_RXTXCommDriver_ ## foo #if defined(__sun__) || defined(__hpux__) @@ -4001,7 +4002,7 @@ } /*---------------------------------------------------------- -RXTXCommDriver.nativeGetVersion +RXTXVersion.nativeGetVersion accept: none perform: return the current version @@ -4010,9 +4011,10 @@ comments: This is used to avoid mixing versions of the .jar and native library. First introduced in rxtx-1.5-9 + Moved from RXTXCommDriver to RXTXVersion in rxtx-2.1-7 ----------------------------------------------------------*/ -JNIEXPORT jstring JNICALL RXTXCommDriver(nativeGetVersion) (JNIEnv *env, +JNIEXPORT jstring JNICALL RXTXVersion(nativeGetVersion) (JNIEnv *env, jclass jclazz ) { return (*env)->NewStringUTF( env, "RXTX-2.1-7pre20" ); From ricardo.trindade at emation.pt Thu Apr 7 03:45:58 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 10:45:58 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: <42550156.2040908@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050407/05212451/attachment-0026.html From thomas.shulok at lmco.com Thu Apr 7 17:43:11 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Thu, 07 Apr 2005 19:43:11 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi There, I'm attempting to talk RS232 between an embedded Linux box and a Windows box. Everything connects up fine, and I can send and receive a simple sequence of bytes with no problems. However, if around 5 seconds goes by without me sending something, I get the following when I attempt to send. java.io.IOException: Input/output error in writeArray Stack trace: java/lang/Throwable.()V java/lang/Throwable.(Ljava/lang/String;)V java/io/IOException.(Ljava/lang/String;)V gnu/io/RXTXPort.writeArray([BIIZ)V gnu/io/RXTXPort$SerialOutputStream.write([B)V SerialTest.main([Ljava/lang/String;)V If there interval is shorter (say 2 seconds between sends), I have no problems. On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and librxtxSerial-2.0.7pre2.so. Any ideas? Thanks, Thom -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5b23dcf/attachment-0026.html From taj at www.linux.org.uk Thu Apr 7 19:22:36 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:22:36 +0100 (BST) Subject: [Rxtx] Input/output error in writeArray In-Reply-To: References: Message-ID: On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a Windows > box. Everything connects up fine, and I can send and receive a simple > sequence of bytes with no problems. However, if around 5 seconds goes > by without me sending something, I get the following when I attempt to > send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Apr 7 19:24:59 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:24:59 +0100 (BST) Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) Message-ID: hmm. This would not work from applets would it? -- Trent Jarvi taj at www.linux.org.uk ---------- Forwarded message ---------- Date: Thu, 07 Apr 2005 16:05:53 -0400 From: Chris Gaffney To: taj at www.linux.org.uk Subject: RXTX Libraries on Classpath fix Hi, I submitted a patch for RXTX a few weeks ago to allow for loading the native libraries from the classpath. Since sending it to you I found it wasn't working on windows. I've fixed the problem and created a new patch that should replace the older one. The actual change is a one line from a String.equals() to a String.startsWith(). Thanks for a great piece of software, -Chris Gaffney Grand Valley State University -------------- next part -------------- A non-text attachment was scrubbed... Name: libraries_on_classpath_fixed.patch Type: text/x-patch Size: 5617 bytes Desc: Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5d423b8/libraries_on_classpath_fixed-0026.bin From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From thomas.shulok at lmco.com Fri Apr 8 10:38:55 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Fri, 08 Apr 2005 12:38:55 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi Trent, Thanks for the prompt response. Before diving deeper, I was wondering if there is a timeout parameter somewhere in the stack that I have not set properly. Given the nature of the failure (only fails if the line has been idle for a few seconds), it feels like some kind of timeout issue... Thanks again, Thom -----Original Message----- From: rxtx-bounces at mail.linuxgrrls.org [mailto:rxtx-bounces at mail.linuxgrrls.org] On Behalf Of Trent Jarvi Sent: Thursday, April 07, 2005 6:23 PM To: Java RXTX discussion Subject: Re: [Rxtx] Input/output error in writeArray On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a > Windows box. Everything connects up fine, and I can send and receive > a simple sequence of bytes with no problems. However, if around 5 > seconds goes by without me sending something, I get the following when > I attempt to send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at mail.linuxgrrls.org http://mail.linuxgrrls.org/mailman/listinfo/rxtx From ricardo.trindade at emation.pt Mon Apr 4 09:17:23 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Mon, 04 Apr 2005 16:17:23 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot Message-ID: <42515A83.4050907@emation.pt> Hi, I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most recent stable snapshot), and get the following exception : It looks like rxtx has been compiled with jdk 1.5. If this was indeed the case, I think there is a compilation flag that generates code that runs on older jdks. java.lang.UnsupportedClassVersionError: gnu/io/UnsupportedCommOperationException (Unsupported major.minor version 49.0) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at java.net.URLClassLoader.defineClass(URLClassLoader.java:251) at java.net.URLClassLoader.access$100(URLClassLoader.java:55) at java.net.URLClassLoader$1.run(URLClassLoader.java:194) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:187) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:141) I'm trying to run it with 1.4. thanks Ricardo From taj at www.linux.org.uk Tue Apr 5 00:48:12 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 07:48:12 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42515A83.4050907@emation.pt> References: <42515A83.4050907@emation.pt> Message-ID: On Mon, 4 Apr 2005, Ricardo Trindade wrote: > Hi, > > I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most > recent stable snapshot), and get the following exception : > > It looks like rxtx has been compiled with jdk 1.5. If this was > indeed the case, I think there is a compilation flag that generates code > that runs on older jdks. > > java.lang.UnsupportedClassVersionError: > gnu/io/UnsupportedCommOperationException (Unsupported major.minor > version 49.0) [snip] Thanks Ricardo I recompiled the jar with javac -source 1.3 -target 1.3. That should cover most of the JRE's in use today. I also compiled the rxtx 2.0 x86_64 native library which appeared to be missing. I tried looking for flags to pass gcc 4.0 to make the native libraries more backwards compatible but only found options for C++ which is not used in rxtx. I've got a list of other bugs that I'll be going through in the next few weeks but for now I just left them with the same CVS filename - no code changes. ftp://ftp.qbang.org/pub/rxtx/rxtx-2.0-CVS-20050120-bins.tar.gz ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-CVS-20050120-bins.tar.gz -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Tue Apr 5 02:24:33 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 05 Apr 2005 09:24:33 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: References: <42515A83.4050907@emation.pt> Message-ID: <42524B41.3040300@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050405/5919abbb/attachment-0027.html From taj at www.linux.org.uk Tue Apr 5 03:00:29 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 10:00:29 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42524B41.3040300@emation.pt> References: <42515A83.4050907@emation.pt> <42524B41.3040300@emation.pt> Message-ID: On Tue, 5 Apr 2005, Ricardo Trindade wrote: > Will you anounce to the list when a new release is available ? > There will be several incremental releases announced here. Once those are done, we will release 2.1.7 and 2.0.7. -- Trent Jarvi taj at www.linux.org.uk From no_spam at somewhere.com Tue Apr 5 11:55:37 2005 From: no_spam at somewhere.com (no_spam@somewhere.com) Date: Tue, 5 Apr 2005 13:55:37 -0400 Subject: [Rxtx] Closing a port from an event listener results in a deadlock Message-ID: <20050405175537.GA21747@rcog.homelinux.net> On the message I sent on March 14, does anyone had the chance to try the modification? Or was it already fixed? (I haven't searched the archive extensively) Or maybe my message got catched by some spam filters? (it made it to the list archive though) Anyway, I would appreciate some feedback (through the list) Thanks From taj at www.linux.org.uk Tue Apr 5 14:42:28 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 21:42:28 +0100 (BST) Subject: [Rxtx] Closing a port from an event listener results in a deadlock In-Reply-To: <20050405175537.GA21747@rcog.homelinux.net> References: <20050405175537.GA21747@rcog.homelinux.net> Message-ID: On Tue, 5 Apr 2005 no_spam at somewhere.com wrote: > On the message I sent on March 14, does anyone had the chance to try the > modification? > > Or was it already fixed? (I haven't searched the archive extensively) > > Or maybe my message got catched by some spam filters? (it made it to the list > archive though) > > Anyway, I would appreciate some feedback (through the list) > The patch is here http://marc.theaimsgroup.com/?l=rxtx&m=111084488820288&w=2 I have applied this patch to a local copy but will not be doing formal testing for a couple weeks. I do not try to close ports from inside the eventListenter usually so I encourage any feedback also. If there are no problems reported, I expect this will go into rxtx 2.1-7. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Wed Apr 6 08:33:42 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Wed, 06 Apr 2005 15:33:42 +0100 Subject: [Rxtx] getting RXTX version Message-ID: <4253F346.50102@emation.pt> Hi, I want to make sure my deployments have the same version of RXTX jar and native lib. I know the version of the jar can be obtained in the Version class, but how can I obtain the native version ? I know RXTX prints to the console a warning if the version is different. Is there a way to programatically know is this is the case ? I would like to log that to our app's log thanks Ricardo From taj at www.linux.org.uk Wed Apr 6 15:10:20 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 6 Apr 2005 22:10:20 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4253F346.50102@emation.pt> References: <4253F346.50102@emation.pt> Message-ID: On Wed, 6 Apr 2005, Ricardo Trindade wrote: > Hi, > > I want to make sure my deployments have the same version of RXTX jar > and native lib. > > I know the version of the jar can be obtained in the Version class, > but how can I obtain the native version ? > > I know RXTX prints to the console a warning if the version is > different. Is there a way to programatically know is this is the case ? > > I would like to log that to our app's log > There isn't a suggested way of doing that right now. We could move things around and have a static String RXTXVersion.getNativeVersion() in future releases. Is this what you expected? This is not documented in commapi at all. I just tossed that in to catch conflicts while developing. It would be nice to have access in GUI applications though. It may be possible to access RXTXCommDriver.LibVersion right now. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Thu Apr 7 02:51:00 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 09:51:00 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> Message-ID: <4254F474.7020905@emation.pt> >There isn't a suggested way of doing that right now. We could move things >around and have a static String RXTXVersion.getNativeVersion() in future >releases. Is this what you expected? > > Yes, that would be perfect. >This is not documented in commapi at all. I just tossed that in to catch >conflicts while developing. It would be nice to have access in GUI >applications though. > >It may be possible to access RXTXCommDriver.LibVersion right now. > > > I tried, and I don't think it's possible. From taj at www.linux.org.uk Thu Apr 7 03:32:04 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 7 Apr 2005 10:32:04 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4254F474.7020905@emation.pt> References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: On Thu, 7 Apr 2005, Ricardo Trindade wrote: > > >There isn't a suggested way of doing that right now. We could move things > >around and have a static String RXTXVersion.getNativeVersion() in future > >releases. Is this what you expected? > > > > > > Yes, that would be perfect. > The attached should do what you want. You will still need to catch an exception for older versions... -- Trent Jarvi taj at www.linux.org.uk -------------- next part -------------- ? public_version.patch Index: RXTXCommDriver.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXCommDriver.java,v retrieving revision 1.16.2.51 diff -u -r1.16.2.51 RXTXCommDriver.java --- RXTXCommDriver.java 12 Oct 2004 09:13:30 -0000 1.16.2.51 +++ RXTXCommDriver.java 7 Apr 2005 09:29:04 -0000 @@ -54,7 +54,7 @@ the Library. */ String JarVersion = RXTXVersion.getVersion(); - String LibVersion = nativeGetVersion(); + String LibVersion = RXTXVersion.nativeGetVersion(); if ( devel ) { System.out.println("Devel Library"); @@ -76,7 +76,6 @@ /** Get the Serial port prefixes for the running OS */ private String deviceDirectory; private String osName; - private static native String nativeGetVersion(); private native boolean registerKnownPorts(int PortType); private native boolean isPortPrefixValid(String dev); private native boolean testRead(String dev, int type); Index: RXTXVersion.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXVersion.java,v retrieving revision 1.2.2.31 diff -u -r1.2.2.31 RXTXVersion.java --- RXTXVersion.java 16 Oct 2004 16:20:35 -0000 1.2.2.31 +++ RXTXVersion.java 7 Apr 2005 09:29:04 -0000 @@ -36,6 +36,7 @@ private static String Version; static { + System.loadLibrary( "rxtxSerial" ); Version = "RXTX-2.1-7pre20"; } /** @@ -47,4 +48,5 @@ { return(Version); } + public static native String nativeGetVersion(); } Index: SerialImp.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v retrieving revision 1.46.2.181 diff -u -r1.46.2.181 SerialImp.c --- SerialImp.c 17 Oct 2004 09:48:56 -0000 1.46.2.181 +++ SerialImp.c 7 Apr 2005 09:29:07 -0000 @@ -116,6 +116,7 @@ * It will eventually be removed. * */ #define RXTXPort(foo) Java_gnu_io_RXTXPort_ ## foo +#define RXTXVersion(foo) Java_gnu_io_RXTXVersion_ ## foo #define RXTXCommDriver(foo) Java_gnu_io_RXTXCommDriver_ ## foo #if defined(__sun__) || defined(__hpux__) @@ -4001,7 +4002,7 @@ } /*---------------------------------------------------------- -RXTXCommDriver.nativeGetVersion +RXTXVersion.nativeGetVersion accept: none perform: return the current version @@ -4010,9 +4011,10 @@ comments: This is used to avoid mixing versions of the .jar and native library. First introduced in rxtx-1.5-9 + Moved from RXTXCommDriver to RXTXVersion in rxtx-2.1-7 ----------------------------------------------------------*/ -JNIEXPORT jstring JNICALL RXTXCommDriver(nativeGetVersion) (JNIEnv *env, +JNIEXPORT jstring JNICALL RXTXVersion(nativeGetVersion) (JNIEnv *env, jclass jclazz ) { return (*env)->NewStringUTF( env, "RXTX-2.1-7pre20" ); From ricardo.trindade at emation.pt Thu Apr 7 03:45:58 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 10:45:58 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: <42550156.2040908@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050407/05212451/attachment-0027.html From thomas.shulok at lmco.com Thu Apr 7 17:43:11 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Thu, 07 Apr 2005 19:43:11 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi There, I'm attempting to talk RS232 between an embedded Linux box and a Windows box. Everything connects up fine, and I can send and receive a simple sequence of bytes with no problems. However, if around 5 seconds goes by without me sending something, I get the following when I attempt to send. java.io.IOException: Input/output error in writeArray Stack trace: java/lang/Throwable.()V java/lang/Throwable.(Ljava/lang/String;)V java/io/IOException.(Ljava/lang/String;)V gnu/io/RXTXPort.writeArray([BIIZ)V gnu/io/RXTXPort$SerialOutputStream.write([B)V SerialTest.main([Ljava/lang/String;)V If there interval is shorter (say 2 seconds between sends), I have no problems. On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and librxtxSerial-2.0.7pre2.so. Any ideas? Thanks, Thom -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5b23dcf/attachment-0027.html From taj at www.linux.org.uk Thu Apr 7 19:22:36 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:22:36 +0100 (BST) Subject: [Rxtx] Input/output error in writeArray In-Reply-To: References: Message-ID: On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a Windows > box. Everything connects up fine, and I can send and receive a simple > sequence of bytes with no problems. However, if around 5 seconds goes > by without me sending something, I get the following when I attempt to > send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Apr 7 19:24:59 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:24:59 +0100 (BST) Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) Message-ID: hmm. This would not work from applets would it? -- Trent Jarvi taj at www.linux.org.uk ---------- Forwarded message ---------- Date: Thu, 07 Apr 2005 16:05:53 -0400 From: Chris Gaffney To: taj at www.linux.org.uk Subject: RXTX Libraries on Classpath fix Hi, I submitted a patch for RXTX a few weeks ago to allow for loading the native libraries from the classpath. Since sending it to you I found it wasn't working on windows. I've fixed the problem and created a new patch that should replace the older one. The actual change is a one line from a String.equals() to a String.startsWith(). Thanks for a great piece of software, -Chris Gaffney Grand Valley State University -------------- next part -------------- A non-text attachment was scrubbed... Name: libraries_on_classpath_fixed.patch Type: text/x-patch Size: 5617 bytes Desc: Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5d423b8/libraries_on_classpath_fixed-0027.bin From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From thomas.shulok at lmco.com Fri Apr 8 10:38:55 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Fri, 08 Apr 2005 12:38:55 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi Trent, Thanks for the prompt response. Before diving deeper, I was wondering if there is a timeout parameter somewhere in the stack that I have not set properly. Given the nature of the failure (only fails if the line has been idle for a few seconds), it feels like some kind of timeout issue... Thanks again, Thom -----Original Message----- From: rxtx-bounces at mail.linuxgrrls.org [mailto:rxtx-bounces at mail.linuxgrrls.org] On Behalf Of Trent Jarvi Sent: Thursday, April 07, 2005 6:23 PM To: Java RXTX discussion Subject: Re: [Rxtx] Input/output error in writeArray On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a > Windows box. Everything connects up fine, and I can send and receive > a simple sequence of bytes with no problems. However, if around 5 > seconds goes by without me sending something, I get the following when > I attempt to send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at mail.linuxgrrls.org http://mail.linuxgrrls.org/mailman/listinfo/rxtx From ricardo.trindade at emation.pt Mon Apr 4 09:17:23 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Mon, 04 Apr 2005 16:17:23 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot Message-ID: <42515A83.4050907@emation.pt> Hi, I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most recent stable snapshot), and get the following exception : It looks like rxtx has been compiled with jdk 1.5. If this was indeed the case, I think there is a compilation flag that generates code that runs on older jdks. java.lang.UnsupportedClassVersionError: gnu/io/UnsupportedCommOperationException (Unsupported major.minor version 49.0) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at java.net.URLClassLoader.defineClass(URLClassLoader.java:251) at java.net.URLClassLoader.access$100(URLClassLoader.java:55) at java.net.URLClassLoader$1.run(URLClassLoader.java:194) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:187) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:141) I'm trying to run it with 1.4. thanks Ricardo From taj at www.linux.org.uk Tue Apr 5 00:48:12 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 07:48:12 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42515A83.4050907@emation.pt> References: <42515A83.4050907@emation.pt> Message-ID: On Mon, 4 Apr 2005, Ricardo Trindade wrote: > Hi, > > I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most > recent stable snapshot), and get the following exception : > > It looks like rxtx has been compiled with jdk 1.5. If this was > indeed the case, I think there is a compilation flag that generates code > that runs on older jdks. > > java.lang.UnsupportedClassVersionError: > gnu/io/UnsupportedCommOperationException (Unsupported major.minor > version 49.0) [snip] Thanks Ricardo I recompiled the jar with javac -source 1.3 -target 1.3. That should cover most of the JRE's in use today. I also compiled the rxtx 2.0 x86_64 native library which appeared to be missing. I tried looking for flags to pass gcc 4.0 to make the native libraries more backwards compatible but only found options for C++ which is not used in rxtx. I've got a list of other bugs that I'll be going through in the next few weeks but for now I just left them with the same CVS filename - no code changes. ftp://ftp.qbang.org/pub/rxtx/rxtx-2.0-CVS-20050120-bins.tar.gz ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-CVS-20050120-bins.tar.gz -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Tue Apr 5 02:24:33 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 05 Apr 2005 09:24:33 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: References: <42515A83.4050907@emation.pt> Message-ID: <42524B41.3040300@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050405/5919abbb/attachment-0028.html From taj at www.linux.org.uk Tue Apr 5 03:00:29 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 10:00:29 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42524B41.3040300@emation.pt> References: <42515A83.4050907@emation.pt> <42524B41.3040300@emation.pt> Message-ID: On Tue, 5 Apr 2005, Ricardo Trindade wrote: > Will you anounce to the list when a new release is available ? > There will be several incremental releases announced here. Once those are done, we will release 2.1.7 and 2.0.7. -- Trent Jarvi taj at www.linux.org.uk From no_spam at somewhere.com Tue Apr 5 11:55:37 2005 From: no_spam at somewhere.com (no_spam@somewhere.com) Date: Tue, 5 Apr 2005 13:55:37 -0400 Subject: [Rxtx] Closing a port from an event listener results in a deadlock Message-ID: <20050405175537.GA21747@rcog.homelinux.net> On the message I sent on March 14, does anyone had the chance to try the modification? Or was it already fixed? (I haven't searched the archive extensively) Or maybe my message got catched by some spam filters? (it made it to the list archive though) Anyway, I would appreciate some feedback (through the list) Thanks From taj at www.linux.org.uk Tue Apr 5 14:42:28 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 21:42:28 +0100 (BST) Subject: [Rxtx] Closing a port from an event listener results in a deadlock In-Reply-To: <20050405175537.GA21747@rcog.homelinux.net> References: <20050405175537.GA21747@rcog.homelinux.net> Message-ID: On Tue, 5 Apr 2005 no_spam at somewhere.com wrote: > On the message I sent on March 14, does anyone had the chance to try the > modification? > > Or was it already fixed? (I haven't searched the archive extensively) > > Or maybe my message got catched by some spam filters? (it made it to the list > archive though) > > Anyway, I would appreciate some feedback (through the list) > The patch is here http://marc.theaimsgroup.com/?l=rxtx&m=111084488820288&w=2 I have applied this patch to a local copy but will not be doing formal testing for a couple weeks. I do not try to close ports from inside the eventListenter usually so I encourage any feedback also. If there are no problems reported, I expect this will go into rxtx 2.1-7. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Wed Apr 6 08:33:42 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Wed, 06 Apr 2005 15:33:42 +0100 Subject: [Rxtx] getting RXTX version Message-ID: <4253F346.50102@emation.pt> Hi, I want to make sure my deployments have the same version of RXTX jar and native lib. I know the version of the jar can be obtained in the Version class, but how can I obtain the native version ? I know RXTX prints to the console a warning if the version is different. Is there a way to programatically know is this is the case ? I would like to log that to our app's log thanks Ricardo From taj at www.linux.org.uk Wed Apr 6 15:10:20 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 6 Apr 2005 22:10:20 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4253F346.50102@emation.pt> References: <4253F346.50102@emation.pt> Message-ID: On Wed, 6 Apr 2005, Ricardo Trindade wrote: > Hi, > > I want to make sure my deployments have the same version of RXTX jar > and native lib. > > I know the version of the jar can be obtained in the Version class, > but how can I obtain the native version ? > > I know RXTX prints to the console a warning if the version is > different. Is there a way to programatically know is this is the case ? > > I would like to log that to our app's log > There isn't a suggested way of doing that right now. We could move things around and have a static String RXTXVersion.getNativeVersion() in future releases. Is this what you expected? This is not documented in commapi at all. I just tossed that in to catch conflicts while developing. It would be nice to have access in GUI applications though. It may be possible to access RXTXCommDriver.LibVersion right now. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Thu Apr 7 02:51:00 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 09:51:00 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> Message-ID: <4254F474.7020905@emation.pt> >There isn't a suggested way of doing that right now. We could move things >around and have a static String RXTXVersion.getNativeVersion() in future >releases. Is this what you expected? > > Yes, that would be perfect. >This is not documented in commapi at all. I just tossed that in to catch >conflicts while developing. It would be nice to have access in GUI >applications though. > >It may be possible to access RXTXCommDriver.LibVersion right now. > > > I tried, and I don't think it's possible. From taj at www.linux.org.uk Thu Apr 7 03:32:04 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 7 Apr 2005 10:32:04 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4254F474.7020905@emation.pt> References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: On Thu, 7 Apr 2005, Ricardo Trindade wrote: > > >There isn't a suggested way of doing that right now. We could move things > >around and have a static String RXTXVersion.getNativeVersion() in future > >releases. Is this what you expected? > > > > > > Yes, that would be perfect. > The attached should do what you want. You will still need to catch an exception for older versions... -- Trent Jarvi taj at www.linux.org.uk -------------- next part -------------- ? public_version.patch Index: RXTXCommDriver.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXCommDriver.java,v retrieving revision 1.16.2.51 diff -u -r1.16.2.51 RXTXCommDriver.java --- RXTXCommDriver.java 12 Oct 2004 09:13:30 -0000 1.16.2.51 +++ RXTXCommDriver.java 7 Apr 2005 09:29:04 -0000 @@ -54,7 +54,7 @@ the Library. */ String JarVersion = RXTXVersion.getVersion(); - String LibVersion = nativeGetVersion(); + String LibVersion = RXTXVersion.nativeGetVersion(); if ( devel ) { System.out.println("Devel Library"); @@ -76,7 +76,6 @@ /** Get the Serial port prefixes for the running OS */ private String deviceDirectory; private String osName; - private static native String nativeGetVersion(); private native boolean registerKnownPorts(int PortType); private native boolean isPortPrefixValid(String dev); private native boolean testRead(String dev, int type); Index: RXTXVersion.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXVersion.java,v retrieving revision 1.2.2.31 diff -u -r1.2.2.31 RXTXVersion.java --- RXTXVersion.java 16 Oct 2004 16:20:35 -0000 1.2.2.31 +++ RXTXVersion.java 7 Apr 2005 09:29:04 -0000 @@ -36,6 +36,7 @@ private static String Version; static { + System.loadLibrary( "rxtxSerial" ); Version = "RXTX-2.1-7pre20"; } /** @@ -47,4 +48,5 @@ { return(Version); } + public static native String nativeGetVersion(); } Index: SerialImp.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v retrieving revision 1.46.2.181 diff -u -r1.46.2.181 SerialImp.c --- SerialImp.c 17 Oct 2004 09:48:56 -0000 1.46.2.181 +++ SerialImp.c 7 Apr 2005 09:29:07 -0000 @@ -116,6 +116,7 @@ * It will eventually be removed. * */ #define RXTXPort(foo) Java_gnu_io_RXTXPort_ ## foo +#define RXTXVersion(foo) Java_gnu_io_RXTXVersion_ ## foo #define RXTXCommDriver(foo) Java_gnu_io_RXTXCommDriver_ ## foo #if defined(__sun__) || defined(__hpux__) @@ -4001,7 +4002,7 @@ } /*---------------------------------------------------------- -RXTXCommDriver.nativeGetVersion +RXTXVersion.nativeGetVersion accept: none perform: return the current version @@ -4010,9 +4011,10 @@ comments: This is used to avoid mixing versions of the .jar and native library. First introduced in rxtx-1.5-9 + Moved from RXTXCommDriver to RXTXVersion in rxtx-2.1-7 ----------------------------------------------------------*/ -JNIEXPORT jstring JNICALL RXTXCommDriver(nativeGetVersion) (JNIEnv *env, +JNIEXPORT jstring JNICALL RXTXVersion(nativeGetVersion) (JNIEnv *env, jclass jclazz ) { return (*env)->NewStringUTF( env, "RXTX-2.1-7pre20" ); From ricardo.trindade at emation.pt Thu Apr 7 03:45:58 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 10:45:58 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: <42550156.2040908@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050407/05212451/attachment-0028.html From thomas.shulok at lmco.com Thu Apr 7 17:43:11 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Thu, 07 Apr 2005 19:43:11 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi There, I'm attempting to talk RS232 between an embedded Linux box and a Windows box. Everything connects up fine, and I can send and receive a simple sequence of bytes with no problems. However, if around 5 seconds goes by without me sending something, I get the following when I attempt to send. java.io.IOException: Input/output error in writeArray Stack trace: java/lang/Throwable.()V java/lang/Throwable.(Ljava/lang/String;)V java/io/IOException.(Ljava/lang/String;)V gnu/io/RXTXPort.writeArray([BIIZ)V gnu/io/RXTXPort$SerialOutputStream.write([B)V SerialTest.main([Ljava/lang/String;)V If there interval is shorter (say 2 seconds between sends), I have no problems. On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and librxtxSerial-2.0.7pre2.so. Any ideas? Thanks, Thom -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5b23dcf/attachment-0028.html From taj at www.linux.org.uk Thu Apr 7 19:22:36 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:22:36 +0100 (BST) Subject: [Rxtx] Input/output error in writeArray In-Reply-To: References: Message-ID: On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a Windows > box. Everything connects up fine, and I can send and receive a simple > sequence of bytes with no problems. However, if around 5 seconds goes > by without me sending something, I get the following when I attempt to > send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Apr 7 19:24:59 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:24:59 +0100 (BST) Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) Message-ID: hmm. This would not work from applets would it? -- Trent Jarvi taj at www.linux.org.uk ---------- Forwarded message ---------- Date: Thu, 07 Apr 2005 16:05:53 -0400 From: Chris Gaffney To: taj at www.linux.org.uk Subject: RXTX Libraries on Classpath fix Hi, I submitted a patch for RXTX a few weeks ago to allow for loading the native libraries from the classpath. Since sending it to you I found it wasn't working on windows. I've fixed the problem and created a new patch that should replace the older one. The actual change is a one line from a String.equals() to a String.startsWith(). Thanks for a great piece of software, -Chris Gaffney Grand Valley State University -------------- next part -------------- A non-text attachment was scrubbed... Name: libraries_on_classpath_fixed.patch Type: text/x-patch Size: 5617 bytes Desc: Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5d423b8/libraries_on_classpath_fixed-0028.bin From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From thomas.shulok at lmco.com Fri Apr 8 10:38:55 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Fri, 08 Apr 2005 12:38:55 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi Trent, Thanks for the prompt response. Before diving deeper, I was wondering if there is a timeout parameter somewhere in the stack that I have not set properly. Given the nature of the failure (only fails if the line has been idle for a few seconds), it feels like some kind of timeout issue... Thanks again, Thom -----Original Message----- From: rxtx-bounces at mail.linuxgrrls.org [mailto:rxtx-bounces at mail.linuxgrrls.org] On Behalf Of Trent Jarvi Sent: Thursday, April 07, 2005 6:23 PM To: Java RXTX discussion Subject: Re: [Rxtx] Input/output error in writeArray On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a > Windows box. Everything connects up fine, and I can send and receive > a simple sequence of bytes with no problems. However, if around 5 > seconds goes by without me sending something, I get the following when > I attempt to send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at mail.linuxgrrls.org http://mail.linuxgrrls.org/mailman/listinfo/rxtx From ricardo.trindade at emation.pt Mon Apr 4 09:17:23 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Mon, 04 Apr 2005 16:17:23 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot Message-ID: <42515A83.4050907@emation.pt> Hi, I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most recent stable snapshot), and get the following exception : It looks like rxtx has been compiled with jdk 1.5. If this was indeed the case, I think there is a compilation flag that generates code that runs on older jdks. java.lang.UnsupportedClassVersionError: gnu/io/UnsupportedCommOperationException (Unsupported major.minor version 49.0) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at java.net.URLClassLoader.defineClass(URLClassLoader.java:251) at java.net.URLClassLoader.access$100(URLClassLoader.java:55) at java.net.URLClassLoader$1.run(URLClassLoader.java:194) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:187) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:141) I'm trying to run it with 1.4. thanks Ricardo From taj at www.linux.org.uk Tue Apr 5 00:48:12 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 07:48:12 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42515A83.4050907@emation.pt> References: <42515A83.4050907@emation.pt> Message-ID: On Mon, 4 Apr 2005, Ricardo Trindade wrote: > Hi, > > I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most > recent stable snapshot), and get the following exception : > > It looks like rxtx has been compiled with jdk 1.5. If this was > indeed the case, I think there is a compilation flag that generates code > that runs on older jdks. > > java.lang.UnsupportedClassVersionError: > gnu/io/UnsupportedCommOperationException (Unsupported major.minor > version 49.0) [snip] Thanks Ricardo I recompiled the jar with javac -source 1.3 -target 1.3. That should cover most of the JRE's in use today. I also compiled the rxtx 2.0 x86_64 native library which appeared to be missing. I tried looking for flags to pass gcc 4.0 to make the native libraries more backwards compatible but only found options for C++ which is not used in rxtx. I've got a list of other bugs that I'll be going through in the next few weeks but for now I just left them with the same CVS filename - no code changes. ftp://ftp.qbang.org/pub/rxtx/rxtx-2.0-CVS-20050120-bins.tar.gz ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-CVS-20050120-bins.tar.gz -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Tue Apr 5 02:24:33 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 05 Apr 2005 09:24:33 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: References: <42515A83.4050907@emation.pt> Message-ID: <42524B41.3040300@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050405/5919abbb/attachment-0029.html From taj at www.linux.org.uk Tue Apr 5 03:00:29 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 10:00:29 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42524B41.3040300@emation.pt> References: <42515A83.4050907@emation.pt> <42524B41.3040300@emation.pt> Message-ID: On Tue, 5 Apr 2005, Ricardo Trindade wrote: > Will you anounce to the list when a new release is available ? > There will be several incremental releases announced here. Once those are done, we will release 2.1.7 and 2.0.7. -- Trent Jarvi taj at www.linux.org.uk From no_spam at somewhere.com Tue Apr 5 11:55:37 2005 From: no_spam at somewhere.com (no_spam@somewhere.com) Date: Tue, 5 Apr 2005 13:55:37 -0400 Subject: [Rxtx] Closing a port from an event listener results in a deadlock Message-ID: <20050405175537.GA21747@rcog.homelinux.net> On the message I sent on March 14, does anyone had the chance to try the modification? Or was it already fixed? (I haven't searched the archive extensively) Or maybe my message got catched by some spam filters? (it made it to the list archive though) Anyway, I would appreciate some feedback (through the list) Thanks From taj at www.linux.org.uk Tue Apr 5 14:42:28 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 21:42:28 +0100 (BST) Subject: [Rxtx] Closing a port from an event listener results in a deadlock In-Reply-To: <20050405175537.GA21747@rcog.homelinux.net> References: <20050405175537.GA21747@rcog.homelinux.net> Message-ID: On Tue, 5 Apr 2005 no_spam at somewhere.com wrote: > On the message I sent on March 14, does anyone had the chance to try the > modification? > > Or was it already fixed? (I haven't searched the archive extensively) > > Or maybe my message got catched by some spam filters? (it made it to the list > archive though) > > Anyway, I would appreciate some feedback (through the list) > The patch is here http://marc.theaimsgroup.com/?l=rxtx&m=111084488820288&w=2 I have applied this patch to a local copy but will not be doing formal testing for a couple weeks. I do not try to close ports from inside the eventListenter usually so I encourage any feedback also. If there are no problems reported, I expect this will go into rxtx 2.1-7. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Wed Apr 6 08:33:42 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Wed, 06 Apr 2005 15:33:42 +0100 Subject: [Rxtx] getting RXTX version Message-ID: <4253F346.50102@emation.pt> Hi, I want to make sure my deployments have the same version of RXTX jar and native lib. I know the version of the jar can be obtained in the Version class, but how can I obtain the native version ? I know RXTX prints to the console a warning if the version is different. Is there a way to programatically know is this is the case ? I would like to log that to our app's log thanks Ricardo From taj at www.linux.org.uk Wed Apr 6 15:10:20 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 6 Apr 2005 22:10:20 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4253F346.50102@emation.pt> References: <4253F346.50102@emation.pt> Message-ID: On Wed, 6 Apr 2005, Ricardo Trindade wrote: > Hi, > > I want to make sure my deployments have the same version of RXTX jar > and native lib. > > I know the version of the jar can be obtained in the Version class, > but how can I obtain the native version ? > > I know RXTX prints to the console a warning if the version is > different. Is there a way to programatically know is this is the case ? > > I would like to log that to our app's log > There isn't a suggested way of doing that right now. We could move things around and have a static String RXTXVersion.getNativeVersion() in future releases. Is this what you expected? This is not documented in commapi at all. I just tossed that in to catch conflicts while developing. It would be nice to have access in GUI applications though. It may be possible to access RXTXCommDriver.LibVersion right now. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Thu Apr 7 02:51:00 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 09:51:00 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> Message-ID: <4254F474.7020905@emation.pt> >There isn't a suggested way of doing that right now. We could move things >around and have a static String RXTXVersion.getNativeVersion() in future >releases. Is this what you expected? > > Yes, that would be perfect. >This is not documented in commapi at all. I just tossed that in to catch >conflicts while developing. It would be nice to have access in GUI >applications though. > >It may be possible to access RXTXCommDriver.LibVersion right now. > > > I tried, and I don't think it's possible. From taj at www.linux.org.uk Thu Apr 7 03:32:04 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 7 Apr 2005 10:32:04 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4254F474.7020905@emation.pt> References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: On Thu, 7 Apr 2005, Ricardo Trindade wrote: > > >There isn't a suggested way of doing that right now. We could move things > >around and have a static String RXTXVersion.getNativeVersion() in future > >releases. Is this what you expected? > > > > > > Yes, that would be perfect. > The attached should do what you want. You will still need to catch an exception for older versions... -- Trent Jarvi taj at www.linux.org.uk -------------- next part -------------- ? public_version.patch Index: RXTXCommDriver.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXCommDriver.java,v retrieving revision 1.16.2.51 diff -u -r1.16.2.51 RXTXCommDriver.java --- RXTXCommDriver.java 12 Oct 2004 09:13:30 -0000 1.16.2.51 +++ RXTXCommDriver.java 7 Apr 2005 09:29:04 -0000 @@ -54,7 +54,7 @@ the Library. */ String JarVersion = RXTXVersion.getVersion(); - String LibVersion = nativeGetVersion(); + String LibVersion = RXTXVersion.nativeGetVersion(); if ( devel ) { System.out.println("Devel Library"); @@ -76,7 +76,6 @@ /** Get the Serial port prefixes for the running OS */ private String deviceDirectory; private String osName; - private static native String nativeGetVersion(); private native boolean registerKnownPorts(int PortType); private native boolean isPortPrefixValid(String dev); private native boolean testRead(String dev, int type); Index: RXTXVersion.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXVersion.java,v retrieving revision 1.2.2.31 diff -u -r1.2.2.31 RXTXVersion.java --- RXTXVersion.java 16 Oct 2004 16:20:35 -0000 1.2.2.31 +++ RXTXVersion.java 7 Apr 2005 09:29:04 -0000 @@ -36,6 +36,7 @@ private static String Version; static { + System.loadLibrary( "rxtxSerial" ); Version = "RXTX-2.1-7pre20"; } /** @@ -47,4 +48,5 @@ { return(Version); } + public static native String nativeGetVersion(); } Index: SerialImp.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v retrieving revision 1.46.2.181 diff -u -r1.46.2.181 SerialImp.c --- SerialImp.c 17 Oct 2004 09:48:56 -0000 1.46.2.181 +++ SerialImp.c 7 Apr 2005 09:29:07 -0000 @@ -116,6 +116,7 @@ * It will eventually be removed. * */ #define RXTXPort(foo) Java_gnu_io_RXTXPort_ ## foo +#define RXTXVersion(foo) Java_gnu_io_RXTXVersion_ ## foo #define RXTXCommDriver(foo) Java_gnu_io_RXTXCommDriver_ ## foo #if defined(__sun__) || defined(__hpux__) @@ -4001,7 +4002,7 @@ } /*---------------------------------------------------------- -RXTXCommDriver.nativeGetVersion +RXTXVersion.nativeGetVersion accept: none perform: return the current version @@ -4010,9 +4011,10 @@ comments: This is used to avoid mixing versions of the .jar and native library. First introduced in rxtx-1.5-9 + Moved from RXTXCommDriver to RXTXVersion in rxtx-2.1-7 ----------------------------------------------------------*/ -JNIEXPORT jstring JNICALL RXTXCommDriver(nativeGetVersion) (JNIEnv *env, +JNIEXPORT jstring JNICALL RXTXVersion(nativeGetVersion) (JNIEnv *env, jclass jclazz ) { return (*env)->NewStringUTF( env, "RXTX-2.1-7pre20" ); From ricardo.trindade at emation.pt Thu Apr 7 03:45:58 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 10:45:58 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: <42550156.2040908@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050407/05212451/attachment-0029.html From thomas.shulok at lmco.com Thu Apr 7 17:43:11 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Thu, 07 Apr 2005 19:43:11 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi There, I'm attempting to talk RS232 between an embedded Linux box and a Windows box. Everything connects up fine, and I can send and receive a simple sequence of bytes with no problems. However, if around 5 seconds goes by without me sending something, I get the following when I attempt to send. java.io.IOException: Input/output error in writeArray Stack trace: java/lang/Throwable.()V java/lang/Throwable.(Ljava/lang/String;)V java/io/IOException.(Ljava/lang/String;)V gnu/io/RXTXPort.writeArray([BIIZ)V gnu/io/RXTXPort$SerialOutputStream.write([B)V SerialTest.main([Ljava/lang/String;)V If there interval is shorter (say 2 seconds between sends), I have no problems. On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and librxtxSerial-2.0.7pre2.so. Any ideas? Thanks, Thom -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5b23dcf/attachment-0029.html From taj at www.linux.org.uk Thu Apr 7 19:22:36 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:22:36 +0100 (BST) Subject: [Rxtx] Input/output error in writeArray In-Reply-To: References: Message-ID: On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a Windows > box. Everything connects up fine, and I can send and receive a simple > sequence of bytes with no problems. However, if around 5 seconds goes > by without me sending something, I get the following when I attempt to > send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Apr 7 19:24:59 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:24:59 +0100 (BST) Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) Message-ID: hmm. This would not work from applets would it? -- Trent Jarvi taj at www.linux.org.uk ---------- Forwarded message ---------- Date: Thu, 07 Apr 2005 16:05:53 -0400 From: Chris Gaffney To: taj at www.linux.org.uk Subject: RXTX Libraries on Classpath fix Hi, I submitted a patch for RXTX a few weeks ago to allow for loading the native libraries from the classpath. Since sending it to you I found it wasn't working on windows. I've fixed the problem and created a new patch that should replace the older one. The actual change is a one line from a String.equals() to a String.startsWith(). Thanks for a great piece of software, -Chris Gaffney Grand Valley State University -------------- next part -------------- A non-text attachment was scrubbed... Name: libraries_on_classpath_fixed.patch Type: text/x-patch Size: 5617 bytes Desc: Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5d423b8/libraries_on_classpath_fixed-0029.bin From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From thomas.shulok at lmco.com Fri Apr 8 10:38:55 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Fri, 08 Apr 2005 12:38:55 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi Trent, Thanks for the prompt response. Before diving deeper, I was wondering if there is a timeout parameter somewhere in the stack that I have not set properly. Given the nature of the failure (only fails if the line has been idle for a few seconds), it feels like some kind of timeout issue... Thanks again, Thom -----Original Message----- From: rxtx-bounces at mail.linuxgrrls.org [mailto:rxtx-bounces at mail.linuxgrrls.org] On Behalf Of Trent Jarvi Sent: Thursday, April 07, 2005 6:23 PM To: Java RXTX discussion Subject: Re: [Rxtx] Input/output error in writeArray On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a > Windows box. Everything connects up fine, and I can send and receive > a simple sequence of bytes with no problems. However, if around 5 > seconds goes by without me sending something, I get the following when > I attempt to send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at mail.linuxgrrls.org http://mail.linuxgrrls.org/mailman/listinfo/rxtx From ricardo.trindade at emation.pt Mon Apr 4 09:17:23 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Mon, 04 Apr 2005 16:17:23 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot Message-ID: <42515A83.4050907@emation.pt> Hi, I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most recent stable snapshot), and get the following exception : It looks like rxtx has been compiled with jdk 1.5. If this was indeed the case, I think there is a compilation flag that generates code that runs on older jdks. java.lang.UnsupportedClassVersionError: gnu/io/UnsupportedCommOperationException (Unsupported major.minor version 49.0) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at java.net.URLClassLoader.defineClass(URLClassLoader.java:251) at java.net.URLClassLoader.access$100(URLClassLoader.java:55) at java.net.URLClassLoader$1.run(URLClassLoader.java:194) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:187) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:141) I'm trying to run it with 1.4. thanks Ricardo From taj at www.linux.org.uk Tue Apr 5 00:48:12 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 07:48:12 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42515A83.4050907@emation.pt> References: <42515A83.4050907@emation.pt> Message-ID: On Mon, 4 Apr 2005, Ricardo Trindade wrote: > Hi, > > I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most > recent stable snapshot), and get the following exception : > > It looks like rxtx has been compiled with jdk 1.5. If this was > indeed the case, I think there is a compilation flag that generates code > that runs on older jdks. > > java.lang.UnsupportedClassVersionError: > gnu/io/UnsupportedCommOperationException (Unsupported major.minor > version 49.0) [snip] Thanks Ricardo I recompiled the jar with javac -source 1.3 -target 1.3. That should cover most of the JRE's in use today. I also compiled the rxtx 2.0 x86_64 native library which appeared to be missing. I tried looking for flags to pass gcc 4.0 to make the native libraries more backwards compatible but only found options for C++ which is not used in rxtx. I've got a list of other bugs that I'll be going through in the next few weeks but for now I just left them with the same CVS filename - no code changes. ftp://ftp.qbang.org/pub/rxtx/rxtx-2.0-CVS-20050120-bins.tar.gz ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-CVS-20050120-bins.tar.gz -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Tue Apr 5 02:24:33 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 05 Apr 2005 09:24:33 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: References: <42515A83.4050907@emation.pt> Message-ID: <42524B41.3040300@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050405/5919abbb/attachment-0030.html From taj at www.linux.org.uk Tue Apr 5 03:00:29 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 10:00:29 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42524B41.3040300@emation.pt> References: <42515A83.4050907@emation.pt> <42524B41.3040300@emation.pt> Message-ID: On Tue, 5 Apr 2005, Ricardo Trindade wrote: > Will you anounce to the list when a new release is available ? > There will be several incremental releases announced here. Once those are done, we will release 2.1.7 and 2.0.7. -- Trent Jarvi taj at www.linux.org.uk From no_spam at somewhere.com Tue Apr 5 11:55:37 2005 From: no_spam at somewhere.com (no_spam@somewhere.com) Date: Tue, 5 Apr 2005 13:55:37 -0400 Subject: [Rxtx] Closing a port from an event listener results in a deadlock Message-ID: <20050405175537.GA21747@rcog.homelinux.net> On the message I sent on March 14, does anyone had the chance to try the modification? Or was it already fixed? (I haven't searched the archive extensively) Or maybe my message got catched by some spam filters? (it made it to the list archive though) Anyway, I would appreciate some feedback (through the list) Thanks From taj at www.linux.org.uk Tue Apr 5 14:42:28 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 21:42:28 +0100 (BST) Subject: [Rxtx] Closing a port from an event listener results in a deadlock In-Reply-To: <20050405175537.GA21747@rcog.homelinux.net> References: <20050405175537.GA21747@rcog.homelinux.net> Message-ID: On Tue, 5 Apr 2005 no_spam at somewhere.com wrote: > On the message I sent on March 14, does anyone had the chance to try the > modification? > > Or was it already fixed? (I haven't searched the archive extensively) > > Or maybe my message got catched by some spam filters? (it made it to the list > archive though) > > Anyway, I would appreciate some feedback (through the list) > The patch is here http://marc.theaimsgroup.com/?l=rxtx&m=111084488820288&w=2 I have applied this patch to a local copy but will not be doing formal testing for a couple weeks. I do not try to close ports from inside the eventListenter usually so I encourage any feedback also. If there are no problems reported, I expect this will go into rxtx 2.1-7. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Wed Apr 6 08:33:42 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Wed, 06 Apr 2005 15:33:42 +0100 Subject: [Rxtx] getting RXTX version Message-ID: <4253F346.50102@emation.pt> Hi, I want to make sure my deployments have the same version of RXTX jar and native lib. I know the version of the jar can be obtained in the Version class, but how can I obtain the native version ? I know RXTX prints to the console a warning if the version is different. Is there a way to programatically know is this is the case ? I would like to log that to our app's log thanks Ricardo From taj at www.linux.org.uk Wed Apr 6 15:10:20 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 6 Apr 2005 22:10:20 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4253F346.50102@emation.pt> References: <4253F346.50102@emation.pt> Message-ID: On Wed, 6 Apr 2005, Ricardo Trindade wrote: > Hi, > > I want to make sure my deployments have the same version of RXTX jar > and native lib. > > I know the version of the jar can be obtained in the Version class, > but how can I obtain the native version ? > > I know RXTX prints to the console a warning if the version is > different. Is there a way to programatically know is this is the case ? > > I would like to log that to our app's log > There isn't a suggested way of doing that right now. We could move things around and have a static String RXTXVersion.getNativeVersion() in future releases. Is this what you expected? This is not documented in commapi at all. I just tossed that in to catch conflicts while developing. It would be nice to have access in GUI applications though. It may be possible to access RXTXCommDriver.LibVersion right now. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Thu Apr 7 02:51:00 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 09:51:00 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> Message-ID: <4254F474.7020905@emation.pt> >There isn't a suggested way of doing that right now. We could move things >around and have a static String RXTXVersion.getNativeVersion() in future >releases. Is this what you expected? > > Yes, that would be perfect. >This is not documented in commapi at all. I just tossed that in to catch >conflicts while developing. It would be nice to have access in GUI >applications though. > >It may be possible to access RXTXCommDriver.LibVersion right now. > > > I tried, and I don't think it's possible. From taj at www.linux.org.uk Thu Apr 7 03:32:04 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 7 Apr 2005 10:32:04 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4254F474.7020905@emation.pt> References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: On Thu, 7 Apr 2005, Ricardo Trindade wrote: > > >There isn't a suggested way of doing that right now. We could move things > >around and have a static String RXTXVersion.getNativeVersion() in future > >releases. Is this what you expected? > > > > > > Yes, that would be perfect. > The attached should do what you want. You will still need to catch an exception for older versions... -- Trent Jarvi taj at www.linux.org.uk -------------- next part -------------- ? public_version.patch Index: RXTXCommDriver.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXCommDriver.java,v retrieving revision 1.16.2.51 diff -u -r1.16.2.51 RXTXCommDriver.java --- RXTXCommDriver.java 12 Oct 2004 09:13:30 -0000 1.16.2.51 +++ RXTXCommDriver.java 7 Apr 2005 09:29:04 -0000 @@ -54,7 +54,7 @@ the Library. */ String JarVersion = RXTXVersion.getVersion(); - String LibVersion = nativeGetVersion(); + String LibVersion = RXTXVersion.nativeGetVersion(); if ( devel ) { System.out.println("Devel Library"); @@ -76,7 +76,6 @@ /** Get the Serial port prefixes for the running OS */ private String deviceDirectory; private String osName; - private static native String nativeGetVersion(); private native boolean registerKnownPorts(int PortType); private native boolean isPortPrefixValid(String dev); private native boolean testRead(String dev, int type); Index: RXTXVersion.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXVersion.java,v retrieving revision 1.2.2.31 diff -u -r1.2.2.31 RXTXVersion.java --- RXTXVersion.java 16 Oct 2004 16:20:35 -0000 1.2.2.31 +++ RXTXVersion.java 7 Apr 2005 09:29:04 -0000 @@ -36,6 +36,7 @@ private static String Version; static { + System.loadLibrary( "rxtxSerial" ); Version = "RXTX-2.1-7pre20"; } /** @@ -47,4 +48,5 @@ { return(Version); } + public static native String nativeGetVersion(); } Index: SerialImp.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v retrieving revision 1.46.2.181 diff -u -r1.46.2.181 SerialImp.c --- SerialImp.c 17 Oct 2004 09:48:56 -0000 1.46.2.181 +++ SerialImp.c 7 Apr 2005 09:29:07 -0000 @@ -116,6 +116,7 @@ * It will eventually be removed. * */ #define RXTXPort(foo) Java_gnu_io_RXTXPort_ ## foo +#define RXTXVersion(foo) Java_gnu_io_RXTXVersion_ ## foo #define RXTXCommDriver(foo) Java_gnu_io_RXTXCommDriver_ ## foo #if defined(__sun__) || defined(__hpux__) @@ -4001,7 +4002,7 @@ } /*---------------------------------------------------------- -RXTXCommDriver.nativeGetVersion +RXTXVersion.nativeGetVersion accept: none perform: return the current version @@ -4010,9 +4011,10 @@ comments: This is used to avoid mixing versions of the .jar and native library. First introduced in rxtx-1.5-9 + Moved from RXTXCommDriver to RXTXVersion in rxtx-2.1-7 ----------------------------------------------------------*/ -JNIEXPORT jstring JNICALL RXTXCommDriver(nativeGetVersion) (JNIEnv *env, +JNIEXPORT jstring JNICALL RXTXVersion(nativeGetVersion) (JNIEnv *env, jclass jclazz ) { return (*env)->NewStringUTF( env, "RXTX-2.1-7pre20" ); From ricardo.trindade at emation.pt Thu Apr 7 03:45:58 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 10:45:58 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: <42550156.2040908@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050407/05212451/attachment-0030.html From thomas.shulok at lmco.com Thu Apr 7 17:43:11 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Thu, 07 Apr 2005 19:43:11 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi There, I'm attempting to talk RS232 between an embedded Linux box and a Windows box. Everything connects up fine, and I can send and receive a simple sequence of bytes with no problems. However, if around 5 seconds goes by without me sending something, I get the following when I attempt to send. java.io.IOException: Input/output error in writeArray Stack trace: java/lang/Throwable.()V java/lang/Throwable.(Ljava/lang/String;)V java/io/IOException.(Ljava/lang/String;)V gnu/io/RXTXPort.writeArray([BIIZ)V gnu/io/RXTXPort$SerialOutputStream.write([B)V SerialTest.main([Ljava/lang/String;)V If there interval is shorter (say 2 seconds between sends), I have no problems. On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and librxtxSerial-2.0.7pre2.so. Any ideas? Thanks, Thom -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5b23dcf/attachment-0030.html From taj at www.linux.org.uk Thu Apr 7 19:22:36 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:22:36 +0100 (BST) Subject: [Rxtx] Input/output error in writeArray In-Reply-To: References: Message-ID: On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a Windows > box. Everything connects up fine, and I can send and receive a simple > sequence of bytes with no problems. However, if around 5 seconds goes > by without me sending something, I get the following when I attempt to > send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Apr 7 19:24:59 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:24:59 +0100 (BST) Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) Message-ID: hmm. This would not work from applets would it? -- Trent Jarvi taj at www.linux.org.uk ---------- Forwarded message ---------- Date: Thu, 07 Apr 2005 16:05:53 -0400 From: Chris Gaffney To: taj at www.linux.org.uk Subject: RXTX Libraries on Classpath fix Hi, I submitted a patch for RXTX a few weeks ago to allow for loading the native libraries from the classpath. Since sending it to you I found it wasn't working on windows. I've fixed the problem and created a new patch that should replace the older one. The actual change is a one line from a String.equals() to a String.startsWith(). Thanks for a great piece of software, -Chris Gaffney Grand Valley State University -------------- next part -------------- A non-text attachment was scrubbed... Name: libraries_on_classpath_fixed.patch Type: text/x-patch Size: 5617 bytes Desc: Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5d423b8/libraries_on_classpath_fixed-0030.bin From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From thomas.shulok at lmco.com Fri Apr 8 10:38:55 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Fri, 08 Apr 2005 12:38:55 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi Trent, Thanks for the prompt response. Before diving deeper, I was wondering if there is a timeout parameter somewhere in the stack that I have not set properly. Given the nature of the failure (only fails if the line has been idle for a few seconds), it feels like some kind of timeout issue... Thanks again, Thom -----Original Message----- From: rxtx-bounces at mail.linuxgrrls.org [mailto:rxtx-bounces at mail.linuxgrrls.org] On Behalf Of Trent Jarvi Sent: Thursday, April 07, 2005 6:23 PM To: Java RXTX discussion Subject: Re: [Rxtx] Input/output error in writeArray On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a > Windows box. Everything connects up fine, and I can send and receive > a simple sequence of bytes with no problems. However, if around 5 > seconds goes by without me sending something, I get the following when > I attempt to send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at mail.linuxgrrls.org http://mail.linuxgrrls.org/mailman/listinfo/rxtx From ricardo.trindade at emation.pt Mon Apr 4 09:17:23 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Mon, 04 Apr 2005 16:17:23 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot Message-ID: <42515A83.4050907@emation.pt> Hi, I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most recent stable snapshot), and get the following exception : It looks like rxtx has been compiled with jdk 1.5. If this was indeed the case, I think there is a compilation flag that generates code that runs on older jdks. java.lang.UnsupportedClassVersionError: gnu/io/UnsupportedCommOperationException (Unsupported major.minor version 49.0) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at java.net.URLClassLoader.defineClass(URLClassLoader.java:251) at java.net.URLClassLoader.access$100(URLClassLoader.java:55) at java.net.URLClassLoader$1.run(URLClassLoader.java:194) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:187) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:141) I'm trying to run it with 1.4. thanks Ricardo From taj at www.linux.org.uk Tue Apr 5 00:48:12 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 07:48:12 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42515A83.4050907@emation.pt> References: <42515A83.4050907@emation.pt> Message-ID: On Mon, 4 Apr 2005, Ricardo Trindade wrote: > Hi, > > I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most > recent stable snapshot), and get the following exception : > > It looks like rxtx has been compiled with jdk 1.5. If this was > indeed the case, I think there is a compilation flag that generates code > that runs on older jdks. > > java.lang.UnsupportedClassVersionError: > gnu/io/UnsupportedCommOperationException (Unsupported major.minor > version 49.0) [snip] Thanks Ricardo I recompiled the jar with javac -source 1.3 -target 1.3. That should cover most of the JRE's in use today. I also compiled the rxtx 2.0 x86_64 native library which appeared to be missing. I tried looking for flags to pass gcc 4.0 to make the native libraries more backwards compatible but only found options for C++ which is not used in rxtx. I've got a list of other bugs that I'll be going through in the next few weeks but for now I just left them with the same CVS filename - no code changes. ftp://ftp.qbang.org/pub/rxtx/rxtx-2.0-CVS-20050120-bins.tar.gz ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-CVS-20050120-bins.tar.gz -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Tue Apr 5 02:24:33 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 05 Apr 2005 09:24:33 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: References: <42515A83.4050907@emation.pt> Message-ID: <42524B41.3040300@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050405/5919abbb/attachment-0031.html From taj at www.linux.org.uk Tue Apr 5 03:00:29 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 10:00:29 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42524B41.3040300@emation.pt> References: <42515A83.4050907@emation.pt> <42524B41.3040300@emation.pt> Message-ID: On Tue, 5 Apr 2005, Ricardo Trindade wrote: > Will you anounce to the list when a new release is available ? > There will be several incremental releases announced here. Once those are done, we will release 2.1.7 and 2.0.7. -- Trent Jarvi taj at www.linux.org.uk From no_spam at somewhere.com Tue Apr 5 11:55:37 2005 From: no_spam at somewhere.com (no_spam@somewhere.com) Date: Tue, 5 Apr 2005 13:55:37 -0400 Subject: [Rxtx] Closing a port from an event listener results in a deadlock Message-ID: <20050405175537.GA21747@rcog.homelinux.net> On the message I sent on March 14, does anyone had the chance to try the modification? Or was it already fixed? (I haven't searched the archive extensively) Or maybe my message got catched by some spam filters? (it made it to the list archive though) Anyway, I would appreciate some feedback (through the list) Thanks From taj at www.linux.org.uk Tue Apr 5 14:42:28 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 21:42:28 +0100 (BST) Subject: [Rxtx] Closing a port from an event listener results in a deadlock In-Reply-To: <20050405175537.GA21747@rcog.homelinux.net> References: <20050405175537.GA21747@rcog.homelinux.net> Message-ID: On Tue, 5 Apr 2005 no_spam at somewhere.com wrote: > On the message I sent on March 14, does anyone had the chance to try the > modification? > > Or was it already fixed? (I haven't searched the archive extensively) > > Or maybe my message got catched by some spam filters? (it made it to the list > archive though) > > Anyway, I would appreciate some feedback (through the list) > The patch is here http://marc.theaimsgroup.com/?l=rxtx&m=111084488820288&w=2 I have applied this patch to a local copy but will not be doing formal testing for a couple weeks. I do not try to close ports from inside the eventListenter usually so I encourage any feedback also. If there are no problems reported, I expect this will go into rxtx 2.1-7. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Wed Apr 6 08:33:42 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Wed, 06 Apr 2005 15:33:42 +0100 Subject: [Rxtx] getting RXTX version Message-ID: <4253F346.50102@emation.pt> Hi, I want to make sure my deployments have the same version of RXTX jar and native lib. I know the version of the jar can be obtained in the Version class, but how can I obtain the native version ? I know RXTX prints to the console a warning if the version is different. Is there a way to programatically know is this is the case ? I would like to log that to our app's log thanks Ricardo From taj at www.linux.org.uk Wed Apr 6 15:10:20 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 6 Apr 2005 22:10:20 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4253F346.50102@emation.pt> References: <4253F346.50102@emation.pt> Message-ID: On Wed, 6 Apr 2005, Ricardo Trindade wrote: > Hi, > > I want to make sure my deployments have the same version of RXTX jar > and native lib. > > I know the version of the jar can be obtained in the Version class, > but how can I obtain the native version ? > > I know RXTX prints to the console a warning if the version is > different. Is there a way to programatically know is this is the case ? > > I would like to log that to our app's log > There isn't a suggested way of doing that right now. We could move things around and have a static String RXTXVersion.getNativeVersion() in future releases. Is this what you expected? This is not documented in commapi at all. I just tossed that in to catch conflicts while developing. It would be nice to have access in GUI applications though. It may be possible to access RXTXCommDriver.LibVersion right now. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Thu Apr 7 02:51:00 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 09:51:00 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> Message-ID: <4254F474.7020905@emation.pt> >There isn't a suggested way of doing that right now. We could move things >around and have a static String RXTXVersion.getNativeVersion() in future >releases. Is this what you expected? > > Yes, that would be perfect. >This is not documented in commapi at all. I just tossed that in to catch >conflicts while developing. It would be nice to have access in GUI >applications though. > >It may be possible to access RXTXCommDriver.LibVersion right now. > > > I tried, and I don't think it's possible. From taj at www.linux.org.uk Thu Apr 7 03:32:04 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 7 Apr 2005 10:32:04 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4254F474.7020905@emation.pt> References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: On Thu, 7 Apr 2005, Ricardo Trindade wrote: > > >There isn't a suggested way of doing that right now. We could move things > >around and have a static String RXTXVersion.getNativeVersion() in future > >releases. Is this what you expected? > > > > > > Yes, that would be perfect. > The attached should do what you want. You will still need to catch an exception for older versions... -- Trent Jarvi taj at www.linux.org.uk -------------- next part -------------- ? public_version.patch Index: RXTXCommDriver.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXCommDriver.java,v retrieving revision 1.16.2.51 diff -u -r1.16.2.51 RXTXCommDriver.java --- RXTXCommDriver.java 12 Oct 2004 09:13:30 -0000 1.16.2.51 +++ RXTXCommDriver.java 7 Apr 2005 09:29:04 -0000 @@ -54,7 +54,7 @@ the Library. */ String JarVersion = RXTXVersion.getVersion(); - String LibVersion = nativeGetVersion(); + String LibVersion = RXTXVersion.nativeGetVersion(); if ( devel ) { System.out.println("Devel Library"); @@ -76,7 +76,6 @@ /** Get the Serial port prefixes for the running OS */ private String deviceDirectory; private String osName; - private static native String nativeGetVersion(); private native boolean registerKnownPorts(int PortType); private native boolean isPortPrefixValid(String dev); private native boolean testRead(String dev, int type); Index: RXTXVersion.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXVersion.java,v retrieving revision 1.2.2.31 diff -u -r1.2.2.31 RXTXVersion.java --- RXTXVersion.java 16 Oct 2004 16:20:35 -0000 1.2.2.31 +++ RXTXVersion.java 7 Apr 2005 09:29:04 -0000 @@ -36,6 +36,7 @@ private static String Version; static { + System.loadLibrary( "rxtxSerial" ); Version = "RXTX-2.1-7pre20"; } /** @@ -47,4 +48,5 @@ { return(Version); } + public static native String nativeGetVersion(); } Index: SerialImp.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v retrieving revision 1.46.2.181 diff -u -r1.46.2.181 SerialImp.c --- SerialImp.c 17 Oct 2004 09:48:56 -0000 1.46.2.181 +++ SerialImp.c 7 Apr 2005 09:29:07 -0000 @@ -116,6 +116,7 @@ * It will eventually be removed. * */ #define RXTXPort(foo) Java_gnu_io_RXTXPort_ ## foo +#define RXTXVersion(foo) Java_gnu_io_RXTXVersion_ ## foo #define RXTXCommDriver(foo) Java_gnu_io_RXTXCommDriver_ ## foo #if defined(__sun__) || defined(__hpux__) @@ -4001,7 +4002,7 @@ } /*---------------------------------------------------------- -RXTXCommDriver.nativeGetVersion +RXTXVersion.nativeGetVersion accept: none perform: return the current version @@ -4010,9 +4011,10 @@ comments: This is used to avoid mixing versions of the .jar and native library. First introduced in rxtx-1.5-9 + Moved from RXTXCommDriver to RXTXVersion in rxtx-2.1-7 ----------------------------------------------------------*/ -JNIEXPORT jstring JNICALL RXTXCommDriver(nativeGetVersion) (JNIEnv *env, +JNIEXPORT jstring JNICALL RXTXVersion(nativeGetVersion) (JNIEnv *env, jclass jclazz ) { return (*env)->NewStringUTF( env, "RXTX-2.1-7pre20" ); From ricardo.trindade at emation.pt Thu Apr 7 03:45:58 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 10:45:58 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: <42550156.2040908@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050407/05212451/attachment-0031.html From thomas.shulok at lmco.com Thu Apr 7 17:43:11 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Thu, 07 Apr 2005 19:43:11 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi There, I'm attempting to talk RS232 between an embedded Linux box and a Windows box. Everything connects up fine, and I can send and receive a simple sequence of bytes with no problems. However, if around 5 seconds goes by without me sending something, I get the following when I attempt to send. java.io.IOException: Input/output error in writeArray Stack trace: java/lang/Throwable.()V java/lang/Throwable.(Ljava/lang/String;)V java/io/IOException.(Ljava/lang/String;)V gnu/io/RXTXPort.writeArray([BIIZ)V gnu/io/RXTXPort$SerialOutputStream.write([B)V SerialTest.main([Ljava/lang/String;)V If there interval is shorter (say 2 seconds between sends), I have no problems. On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and librxtxSerial-2.0.7pre2.so. Any ideas? Thanks, Thom -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5b23dcf/attachment-0031.html From taj at www.linux.org.uk Thu Apr 7 19:22:36 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:22:36 +0100 (BST) Subject: [Rxtx] Input/output error in writeArray In-Reply-To: References: Message-ID: On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a Windows > box. Everything connects up fine, and I can send and receive a simple > sequence of bytes with no problems. However, if around 5 seconds goes > by without me sending something, I get the following when I attempt to > send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Apr 7 19:24:59 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:24:59 +0100 (BST) Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) Message-ID: hmm. This would not work from applets would it? -- Trent Jarvi taj at www.linux.org.uk ---------- Forwarded message ---------- Date: Thu, 07 Apr 2005 16:05:53 -0400 From: Chris Gaffney To: taj at www.linux.org.uk Subject: RXTX Libraries on Classpath fix Hi, I submitted a patch for RXTX a few weeks ago to allow for loading the native libraries from the classpath. Since sending it to you I found it wasn't working on windows. I've fixed the problem and created a new patch that should replace the older one. The actual change is a one line from a String.equals() to a String.startsWith(). Thanks for a great piece of software, -Chris Gaffney Grand Valley State University -------------- next part -------------- A non-text attachment was scrubbed... Name: libraries_on_classpath_fixed.patch Type: text/x-patch Size: 5617 bytes Desc: Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5d423b8/libraries_on_classpath_fixed-0031.bin From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From thomas.shulok at lmco.com Fri Apr 8 10:38:55 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Fri, 08 Apr 2005 12:38:55 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi Trent, Thanks for the prompt response. Before diving deeper, I was wondering if there is a timeout parameter somewhere in the stack that I have not set properly. Given the nature of the failure (only fails if the line has been idle for a few seconds), it feels like some kind of timeout issue... Thanks again, Thom -----Original Message----- From: rxtx-bounces at mail.linuxgrrls.org [mailto:rxtx-bounces at mail.linuxgrrls.org] On Behalf Of Trent Jarvi Sent: Thursday, April 07, 2005 6:23 PM To: Java RXTX discussion Subject: Re: [Rxtx] Input/output error in writeArray On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a > Windows box. Everything connects up fine, and I can send and receive > a simple sequence of bytes with no problems. However, if around 5 > seconds goes by without me sending something, I get the following when > I attempt to send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at mail.linuxgrrls.org http://mail.linuxgrrls.org/mailman/listinfo/rxtx From ricardo.trindade at emation.pt Mon Apr 4 09:17:23 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Mon, 04 Apr 2005 16:17:23 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot Message-ID: <42515A83.4050907@emation.pt> Hi, I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most recent stable snapshot), and get the following exception : It looks like rxtx has been compiled with jdk 1.5. If this was indeed the case, I think there is a compilation flag that generates code that runs on older jdks. java.lang.UnsupportedClassVersionError: gnu/io/UnsupportedCommOperationException (Unsupported major.minor version 49.0) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at java.net.URLClassLoader.defineClass(URLClassLoader.java:251) at java.net.URLClassLoader.access$100(URLClassLoader.java:55) at java.net.URLClassLoader$1.run(URLClassLoader.java:194) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:187) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:141) I'm trying to run it with 1.4. thanks Ricardo From taj at www.linux.org.uk Tue Apr 5 00:48:12 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 07:48:12 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42515A83.4050907@emation.pt> References: <42515A83.4050907@emation.pt> Message-ID: On Mon, 4 Apr 2005, Ricardo Trindade wrote: > Hi, > > I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most > recent stable snapshot), and get the following exception : > > It looks like rxtx has been compiled with jdk 1.5. If this was > indeed the case, I think there is a compilation flag that generates code > that runs on older jdks. > > java.lang.UnsupportedClassVersionError: > gnu/io/UnsupportedCommOperationException (Unsupported major.minor > version 49.0) [snip] Thanks Ricardo I recompiled the jar with javac -source 1.3 -target 1.3. That should cover most of the JRE's in use today. I also compiled the rxtx 2.0 x86_64 native library which appeared to be missing. I tried looking for flags to pass gcc 4.0 to make the native libraries more backwards compatible but only found options for C++ which is not used in rxtx. I've got a list of other bugs that I'll be going through in the next few weeks but for now I just left them with the same CVS filename - no code changes. ftp://ftp.qbang.org/pub/rxtx/rxtx-2.0-CVS-20050120-bins.tar.gz ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-CVS-20050120-bins.tar.gz -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Tue Apr 5 02:24:33 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 05 Apr 2005 09:24:33 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: References: <42515A83.4050907@emation.pt> Message-ID: <42524B41.3040300@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050405/5919abbb/attachment-0032.html From taj at www.linux.org.uk Tue Apr 5 03:00:29 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 10:00:29 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42524B41.3040300@emation.pt> References: <42515A83.4050907@emation.pt> <42524B41.3040300@emation.pt> Message-ID: On Tue, 5 Apr 2005, Ricardo Trindade wrote: > Will you anounce to the list when a new release is available ? > There will be several incremental releases announced here. Once those are done, we will release 2.1.7 and 2.0.7. -- Trent Jarvi taj at www.linux.org.uk From no_spam at somewhere.com Tue Apr 5 11:55:37 2005 From: no_spam at somewhere.com (no_spam@somewhere.com) Date: Tue, 5 Apr 2005 13:55:37 -0400 Subject: [Rxtx] Closing a port from an event listener results in a deadlock Message-ID: <20050405175537.GA21747@rcog.homelinux.net> On the message I sent on March 14, does anyone had the chance to try the modification? Or was it already fixed? (I haven't searched the archive extensively) Or maybe my message got catched by some spam filters? (it made it to the list archive though) Anyway, I would appreciate some feedback (through the list) Thanks From taj at www.linux.org.uk Tue Apr 5 14:42:28 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 21:42:28 +0100 (BST) Subject: [Rxtx] Closing a port from an event listener results in a deadlock In-Reply-To: <20050405175537.GA21747@rcog.homelinux.net> References: <20050405175537.GA21747@rcog.homelinux.net> Message-ID: On Tue, 5 Apr 2005 no_spam at somewhere.com wrote: > On the message I sent on March 14, does anyone had the chance to try the > modification? > > Or was it already fixed? (I haven't searched the archive extensively) > > Or maybe my message got catched by some spam filters? (it made it to the list > archive though) > > Anyway, I would appreciate some feedback (through the list) > The patch is here http://marc.theaimsgroup.com/?l=rxtx&m=111084488820288&w=2 I have applied this patch to a local copy but will not be doing formal testing for a couple weeks. I do not try to close ports from inside the eventListenter usually so I encourage any feedback also. If there are no problems reported, I expect this will go into rxtx 2.1-7. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Wed Apr 6 08:33:42 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Wed, 06 Apr 2005 15:33:42 +0100 Subject: [Rxtx] getting RXTX version Message-ID: <4253F346.50102@emation.pt> Hi, I want to make sure my deployments have the same version of RXTX jar and native lib. I know the version of the jar can be obtained in the Version class, but how can I obtain the native version ? I know RXTX prints to the console a warning if the version is different. Is there a way to programatically know is this is the case ? I would like to log that to our app's log thanks Ricardo From taj at www.linux.org.uk Wed Apr 6 15:10:20 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 6 Apr 2005 22:10:20 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4253F346.50102@emation.pt> References: <4253F346.50102@emation.pt> Message-ID: On Wed, 6 Apr 2005, Ricardo Trindade wrote: > Hi, > > I want to make sure my deployments have the same version of RXTX jar > and native lib. > > I know the version of the jar can be obtained in the Version class, > but how can I obtain the native version ? > > I know RXTX prints to the console a warning if the version is > different. Is there a way to programatically know is this is the case ? > > I would like to log that to our app's log > There isn't a suggested way of doing that right now. We could move things around and have a static String RXTXVersion.getNativeVersion() in future releases. Is this what you expected? This is not documented in commapi at all. I just tossed that in to catch conflicts while developing. It would be nice to have access in GUI applications though. It may be possible to access RXTXCommDriver.LibVersion right now. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Thu Apr 7 02:51:00 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 09:51:00 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> Message-ID: <4254F474.7020905@emation.pt> >There isn't a suggested way of doing that right now. We could move things >around and have a static String RXTXVersion.getNativeVersion() in future >releases. Is this what you expected? > > Yes, that would be perfect. >This is not documented in commapi at all. I just tossed that in to catch >conflicts while developing. It would be nice to have access in GUI >applications though. > >It may be possible to access RXTXCommDriver.LibVersion right now. > > > I tried, and I don't think it's possible. From taj at www.linux.org.uk Thu Apr 7 03:32:04 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 7 Apr 2005 10:32:04 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4254F474.7020905@emation.pt> References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: On Thu, 7 Apr 2005, Ricardo Trindade wrote: > > >There isn't a suggested way of doing that right now. We could move things > >around and have a static String RXTXVersion.getNativeVersion() in future > >releases. Is this what you expected? > > > > > > Yes, that would be perfect. > The attached should do what you want. You will still need to catch an exception for older versions... -- Trent Jarvi taj at www.linux.org.uk -------------- next part -------------- ? public_version.patch Index: RXTXCommDriver.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXCommDriver.java,v retrieving revision 1.16.2.51 diff -u -r1.16.2.51 RXTXCommDriver.java --- RXTXCommDriver.java 12 Oct 2004 09:13:30 -0000 1.16.2.51 +++ RXTXCommDriver.java 7 Apr 2005 09:29:04 -0000 @@ -54,7 +54,7 @@ the Library. */ String JarVersion = RXTXVersion.getVersion(); - String LibVersion = nativeGetVersion(); + String LibVersion = RXTXVersion.nativeGetVersion(); if ( devel ) { System.out.println("Devel Library"); @@ -76,7 +76,6 @@ /** Get the Serial port prefixes for the running OS */ private String deviceDirectory; private String osName; - private static native String nativeGetVersion(); private native boolean registerKnownPorts(int PortType); private native boolean isPortPrefixValid(String dev); private native boolean testRead(String dev, int type); Index: RXTXVersion.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXVersion.java,v retrieving revision 1.2.2.31 diff -u -r1.2.2.31 RXTXVersion.java --- RXTXVersion.java 16 Oct 2004 16:20:35 -0000 1.2.2.31 +++ RXTXVersion.java 7 Apr 2005 09:29:04 -0000 @@ -36,6 +36,7 @@ private static String Version; static { + System.loadLibrary( "rxtxSerial" ); Version = "RXTX-2.1-7pre20"; } /** @@ -47,4 +48,5 @@ { return(Version); } + public static native String nativeGetVersion(); } Index: SerialImp.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v retrieving revision 1.46.2.181 diff -u -r1.46.2.181 SerialImp.c --- SerialImp.c 17 Oct 2004 09:48:56 -0000 1.46.2.181 +++ SerialImp.c 7 Apr 2005 09:29:07 -0000 @@ -116,6 +116,7 @@ * It will eventually be removed. * */ #define RXTXPort(foo) Java_gnu_io_RXTXPort_ ## foo +#define RXTXVersion(foo) Java_gnu_io_RXTXVersion_ ## foo #define RXTXCommDriver(foo) Java_gnu_io_RXTXCommDriver_ ## foo #if defined(__sun__) || defined(__hpux__) @@ -4001,7 +4002,7 @@ } /*---------------------------------------------------------- -RXTXCommDriver.nativeGetVersion +RXTXVersion.nativeGetVersion accept: none perform: return the current version @@ -4010,9 +4011,10 @@ comments: This is used to avoid mixing versions of the .jar and native library. First introduced in rxtx-1.5-9 + Moved from RXTXCommDriver to RXTXVersion in rxtx-2.1-7 ----------------------------------------------------------*/ -JNIEXPORT jstring JNICALL RXTXCommDriver(nativeGetVersion) (JNIEnv *env, +JNIEXPORT jstring JNICALL RXTXVersion(nativeGetVersion) (JNIEnv *env, jclass jclazz ) { return (*env)->NewStringUTF( env, "RXTX-2.1-7pre20" ); From ricardo.trindade at emation.pt Thu Apr 7 03:45:58 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 10:45:58 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: <42550156.2040908@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050407/05212451/attachment-0032.html From thomas.shulok at lmco.com Thu Apr 7 17:43:11 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Thu, 07 Apr 2005 19:43:11 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi There, I'm attempting to talk RS232 between an embedded Linux box and a Windows box. Everything connects up fine, and I can send and receive a simple sequence of bytes with no problems. However, if around 5 seconds goes by without me sending something, I get the following when I attempt to send. java.io.IOException: Input/output error in writeArray Stack trace: java/lang/Throwable.()V java/lang/Throwable.(Ljava/lang/String;)V java/io/IOException.(Ljava/lang/String;)V gnu/io/RXTXPort.writeArray([BIIZ)V gnu/io/RXTXPort$SerialOutputStream.write([B)V SerialTest.main([Ljava/lang/String;)V If there interval is shorter (say 2 seconds between sends), I have no problems. On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and librxtxSerial-2.0.7pre2.so. Any ideas? Thanks, Thom -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5b23dcf/attachment-0032.html From taj at www.linux.org.uk Thu Apr 7 19:22:36 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:22:36 +0100 (BST) Subject: [Rxtx] Input/output error in writeArray In-Reply-To: References: Message-ID: On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a Windows > box. Everything connects up fine, and I can send and receive a simple > sequence of bytes with no problems. However, if around 5 seconds goes > by without me sending something, I get the following when I attempt to > send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Apr 7 19:24:59 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:24:59 +0100 (BST) Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) Message-ID: hmm. This would not work from applets would it? -- Trent Jarvi taj at www.linux.org.uk ---------- Forwarded message ---------- Date: Thu, 07 Apr 2005 16:05:53 -0400 From: Chris Gaffney To: taj at www.linux.org.uk Subject: RXTX Libraries on Classpath fix Hi, I submitted a patch for RXTX a few weeks ago to allow for loading the native libraries from the classpath. Since sending it to you I found it wasn't working on windows. I've fixed the problem and created a new patch that should replace the older one. The actual change is a one line from a String.equals() to a String.startsWith(). Thanks for a great piece of software, -Chris Gaffney Grand Valley State University -------------- next part -------------- A non-text attachment was scrubbed... Name: libraries_on_classpath_fixed.patch Type: text/x-patch Size: 5617 bytes Desc: Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5d423b8/libraries_on_classpath_fixed-0032.bin From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From thomas.shulok at lmco.com Fri Apr 8 10:38:55 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Fri, 08 Apr 2005 12:38:55 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi Trent, Thanks for the prompt response. Before diving deeper, I was wondering if there is a timeout parameter somewhere in the stack that I have not set properly. Given the nature of the failure (only fails if the line has been idle for a few seconds), it feels like some kind of timeout issue... Thanks again, Thom -----Original Message----- From: rxtx-bounces at mail.linuxgrrls.org [mailto:rxtx-bounces at mail.linuxgrrls.org] On Behalf Of Trent Jarvi Sent: Thursday, April 07, 2005 6:23 PM To: Java RXTX discussion Subject: Re: [Rxtx] Input/output error in writeArray On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a > Windows box. Everything connects up fine, and I can send and receive > a simple sequence of bytes with no problems. However, if around 5 > seconds goes by without me sending something, I get the following when > I attempt to send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at mail.linuxgrrls.org http://mail.linuxgrrls.org/mailman/listinfo/rxtx From ricardo.trindade at emation.pt Mon Apr 4 09:17:23 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Mon, 04 Apr 2005 16:17:23 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot Message-ID: <42515A83.4050907@emation.pt> Hi, I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most recent stable snapshot), and get the following exception : It looks like rxtx has been compiled with jdk 1.5. If this was indeed the case, I think there is a compilation flag that generates code that runs on older jdks. java.lang.UnsupportedClassVersionError: gnu/io/UnsupportedCommOperationException (Unsupported major.minor version 49.0) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at java.net.URLClassLoader.defineClass(URLClassLoader.java:251) at java.net.URLClassLoader.access$100(URLClassLoader.java:55) at java.net.URLClassLoader$1.run(URLClassLoader.java:194) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:187) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:141) I'm trying to run it with 1.4. thanks Ricardo From taj at www.linux.org.uk Tue Apr 5 00:48:12 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 07:48:12 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42515A83.4050907@emation.pt> References: <42515A83.4050907@emation.pt> Message-ID: On Mon, 4 Apr 2005, Ricardo Trindade wrote: > Hi, > > I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most > recent stable snapshot), and get the following exception : > > It looks like rxtx has been compiled with jdk 1.5. If this was > indeed the case, I think there is a compilation flag that generates code > that runs on older jdks. > > java.lang.UnsupportedClassVersionError: > gnu/io/UnsupportedCommOperationException (Unsupported major.minor > version 49.0) [snip] Thanks Ricardo I recompiled the jar with javac -source 1.3 -target 1.3. That should cover most of the JRE's in use today. I also compiled the rxtx 2.0 x86_64 native library which appeared to be missing. I tried looking for flags to pass gcc 4.0 to make the native libraries more backwards compatible but only found options for C++ which is not used in rxtx. I've got a list of other bugs that I'll be going through in the next few weeks but for now I just left them with the same CVS filename - no code changes. ftp://ftp.qbang.org/pub/rxtx/rxtx-2.0-CVS-20050120-bins.tar.gz ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-CVS-20050120-bins.tar.gz -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Tue Apr 5 02:24:33 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 05 Apr 2005 09:24:33 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: References: <42515A83.4050907@emation.pt> Message-ID: <42524B41.3040300@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050405/5919abbb/attachment-0033.html From taj at www.linux.org.uk Tue Apr 5 03:00:29 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 10:00:29 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42524B41.3040300@emation.pt> References: <42515A83.4050907@emation.pt> <42524B41.3040300@emation.pt> Message-ID: On Tue, 5 Apr 2005, Ricardo Trindade wrote: > Will you anounce to the list when a new release is available ? > There will be several incremental releases announced here. Once those are done, we will release 2.1.7 and 2.0.7. -- Trent Jarvi taj at www.linux.org.uk From no_spam at somewhere.com Tue Apr 5 11:55:37 2005 From: no_spam at somewhere.com (no_spam@somewhere.com) Date: Tue, 5 Apr 2005 13:55:37 -0400 Subject: [Rxtx] Closing a port from an event listener results in a deadlock Message-ID: <20050405175537.GA21747@rcog.homelinux.net> On the message I sent on March 14, does anyone had the chance to try the modification? Or was it already fixed? (I haven't searched the archive extensively) Or maybe my message got catched by some spam filters? (it made it to the list archive though) Anyway, I would appreciate some feedback (through the list) Thanks From taj at www.linux.org.uk Tue Apr 5 14:42:28 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 21:42:28 +0100 (BST) Subject: [Rxtx] Closing a port from an event listener results in a deadlock In-Reply-To: <20050405175537.GA21747@rcog.homelinux.net> References: <20050405175537.GA21747@rcog.homelinux.net> Message-ID: On Tue, 5 Apr 2005 no_spam at somewhere.com wrote: > On the message I sent on March 14, does anyone had the chance to try the > modification? > > Or was it already fixed? (I haven't searched the archive extensively) > > Or maybe my message got catched by some spam filters? (it made it to the list > archive though) > > Anyway, I would appreciate some feedback (through the list) > The patch is here http://marc.theaimsgroup.com/?l=rxtx&m=111084488820288&w=2 I have applied this patch to a local copy but will not be doing formal testing for a couple weeks. I do not try to close ports from inside the eventListenter usually so I encourage any feedback also. If there are no problems reported, I expect this will go into rxtx 2.1-7. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Wed Apr 6 08:33:42 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Wed, 06 Apr 2005 15:33:42 +0100 Subject: [Rxtx] getting RXTX version Message-ID: <4253F346.50102@emation.pt> Hi, I want to make sure my deployments have the same version of RXTX jar and native lib. I know the version of the jar can be obtained in the Version class, but how can I obtain the native version ? I know RXTX prints to the console a warning if the version is different. Is there a way to programatically know is this is the case ? I would like to log that to our app's log thanks Ricardo From taj at www.linux.org.uk Wed Apr 6 15:10:20 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 6 Apr 2005 22:10:20 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4253F346.50102@emation.pt> References: <4253F346.50102@emation.pt> Message-ID: On Wed, 6 Apr 2005, Ricardo Trindade wrote: > Hi, > > I want to make sure my deployments have the same version of RXTX jar > and native lib. > > I know the version of the jar can be obtained in the Version class, > but how can I obtain the native version ? > > I know RXTX prints to the console a warning if the version is > different. Is there a way to programatically know is this is the case ? > > I would like to log that to our app's log > There isn't a suggested way of doing that right now. We could move things around and have a static String RXTXVersion.getNativeVersion() in future releases. Is this what you expected? This is not documented in commapi at all. I just tossed that in to catch conflicts while developing. It would be nice to have access in GUI applications though. It may be possible to access RXTXCommDriver.LibVersion right now. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Thu Apr 7 02:51:00 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 09:51:00 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> Message-ID: <4254F474.7020905@emation.pt> >There isn't a suggested way of doing that right now. We could move things >around and have a static String RXTXVersion.getNativeVersion() in future >releases. Is this what you expected? > > Yes, that would be perfect. >This is not documented in commapi at all. I just tossed that in to catch >conflicts while developing. It would be nice to have access in GUI >applications though. > >It may be possible to access RXTXCommDriver.LibVersion right now. > > > I tried, and I don't think it's possible. From taj at www.linux.org.uk Thu Apr 7 03:32:04 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 7 Apr 2005 10:32:04 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4254F474.7020905@emation.pt> References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: On Thu, 7 Apr 2005, Ricardo Trindade wrote: > > >There isn't a suggested way of doing that right now. We could move things > >around and have a static String RXTXVersion.getNativeVersion() in future > >releases. Is this what you expected? > > > > > > Yes, that would be perfect. > The attached should do what you want. You will still need to catch an exception for older versions... -- Trent Jarvi taj at www.linux.org.uk -------------- next part -------------- ? public_version.patch Index: RXTXCommDriver.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXCommDriver.java,v retrieving revision 1.16.2.51 diff -u -r1.16.2.51 RXTXCommDriver.java --- RXTXCommDriver.java 12 Oct 2004 09:13:30 -0000 1.16.2.51 +++ RXTXCommDriver.java 7 Apr 2005 09:29:04 -0000 @@ -54,7 +54,7 @@ the Library. */ String JarVersion = RXTXVersion.getVersion(); - String LibVersion = nativeGetVersion(); + String LibVersion = RXTXVersion.nativeGetVersion(); if ( devel ) { System.out.println("Devel Library"); @@ -76,7 +76,6 @@ /** Get the Serial port prefixes for the running OS */ private String deviceDirectory; private String osName; - private static native String nativeGetVersion(); private native boolean registerKnownPorts(int PortType); private native boolean isPortPrefixValid(String dev); private native boolean testRead(String dev, int type); Index: RXTXVersion.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXVersion.java,v retrieving revision 1.2.2.31 diff -u -r1.2.2.31 RXTXVersion.java --- RXTXVersion.java 16 Oct 2004 16:20:35 -0000 1.2.2.31 +++ RXTXVersion.java 7 Apr 2005 09:29:04 -0000 @@ -36,6 +36,7 @@ private static String Version; static { + System.loadLibrary( "rxtxSerial" ); Version = "RXTX-2.1-7pre20"; } /** @@ -47,4 +48,5 @@ { return(Version); } + public static native String nativeGetVersion(); } Index: SerialImp.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v retrieving revision 1.46.2.181 diff -u -r1.46.2.181 SerialImp.c --- SerialImp.c 17 Oct 2004 09:48:56 -0000 1.46.2.181 +++ SerialImp.c 7 Apr 2005 09:29:07 -0000 @@ -116,6 +116,7 @@ * It will eventually be removed. * */ #define RXTXPort(foo) Java_gnu_io_RXTXPort_ ## foo +#define RXTXVersion(foo) Java_gnu_io_RXTXVersion_ ## foo #define RXTXCommDriver(foo) Java_gnu_io_RXTXCommDriver_ ## foo #if defined(__sun__) || defined(__hpux__) @@ -4001,7 +4002,7 @@ } /*---------------------------------------------------------- -RXTXCommDriver.nativeGetVersion +RXTXVersion.nativeGetVersion accept: none perform: return the current version @@ -4010,9 +4011,10 @@ comments: This is used to avoid mixing versions of the .jar and native library. First introduced in rxtx-1.5-9 + Moved from RXTXCommDriver to RXTXVersion in rxtx-2.1-7 ----------------------------------------------------------*/ -JNIEXPORT jstring JNICALL RXTXCommDriver(nativeGetVersion) (JNIEnv *env, +JNIEXPORT jstring JNICALL RXTXVersion(nativeGetVersion) (JNIEnv *env, jclass jclazz ) { return (*env)->NewStringUTF( env, "RXTX-2.1-7pre20" ); From ricardo.trindade at emation.pt Thu Apr 7 03:45:58 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 10:45:58 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: <42550156.2040908@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050407/05212451/attachment-0033.html From thomas.shulok at lmco.com Thu Apr 7 17:43:11 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Thu, 07 Apr 2005 19:43:11 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi There, I'm attempting to talk RS232 between an embedded Linux box and a Windows box. Everything connects up fine, and I can send and receive a simple sequence of bytes with no problems. However, if around 5 seconds goes by without me sending something, I get the following when I attempt to send. java.io.IOException: Input/output error in writeArray Stack trace: java/lang/Throwable.()V java/lang/Throwable.(Ljava/lang/String;)V java/io/IOException.(Ljava/lang/String;)V gnu/io/RXTXPort.writeArray([BIIZ)V gnu/io/RXTXPort$SerialOutputStream.write([B)V SerialTest.main([Ljava/lang/String;)V If there interval is shorter (say 2 seconds between sends), I have no problems. On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and librxtxSerial-2.0.7pre2.so. Any ideas? Thanks, Thom -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5b23dcf/attachment-0033.html From taj at www.linux.org.uk Thu Apr 7 19:22:36 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:22:36 +0100 (BST) Subject: [Rxtx] Input/output error in writeArray In-Reply-To: References: Message-ID: On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a Windows > box. Everything connects up fine, and I can send and receive a simple > sequence of bytes with no problems. However, if around 5 seconds goes > by without me sending something, I get the following when I attempt to > send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Apr 7 19:24:59 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:24:59 +0100 (BST) Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) Message-ID: hmm. This would not work from applets would it? -- Trent Jarvi taj at www.linux.org.uk ---------- Forwarded message ---------- Date: Thu, 07 Apr 2005 16:05:53 -0400 From: Chris Gaffney To: taj at www.linux.org.uk Subject: RXTX Libraries on Classpath fix Hi, I submitted a patch for RXTX a few weeks ago to allow for loading the native libraries from the classpath. Since sending it to you I found it wasn't working on windows. I've fixed the problem and created a new patch that should replace the older one. The actual change is a one line from a String.equals() to a String.startsWith(). Thanks for a great piece of software, -Chris Gaffney Grand Valley State University -------------- next part -------------- A non-text attachment was scrubbed... Name: libraries_on_classpath_fixed.patch Type: text/x-patch Size: 5617 bytes Desc: Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5d423b8/libraries_on_classpath_fixed-0033.bin From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From thomas.shulok at lmco.com Fri Apr 8 10:38:55 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Fri, 08 Apr 2005 12:38:55 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi Trent, Thanks for the prompt response. Before diving deeper, I was wondering if there is a timeout parameter somewhere in the stack that I have not set properly. Given the nature of the failure (only fails if the line has been idle for a few seconds), it feels like some kind of timeout issue... Thanks again, Thom -----Original Message----- From: rxtx-bounces at mail.linuxgrrls.org [mailto:rxtx-bounces at mail.linuxgrrls.org] On Behalf Of Trent Jarvi Sent: Thursday, April 07, 2005 6:23 PM To: Java RXTX discussion Subject: Re: [Rxtx] Input/output error in writeArray On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a > Windows box. Everything connects up fine, and I can send and receive > a simple sequence of bytes with no problems. However, if around 5 > seconds goes by without me sending something, I get the following when > I attempt to send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at mail.linuxgrrls.org http://mail.linuxgrrls.org/mailman/listinfo/rxtx From ricardo.trindade at emation.pt Mon Apr 4 09:17:23 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Mon, 04 Apr 2005 16:17:23 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot Message-ID: <42515A83.4050907@emation.pt> Hi, I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most recent stable snapshot), and get the following exception : It looks like rxtx has been compiled with jdk 1.5. If this was indeed the case, I think there is a compilation flag that generates code that runs on older jdks. java.lang.UnsupportedClassVersionError: gnu/io/UnsupportedCommOperationException (Unsupported major.minor version 49.0) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at java.net.URLClassLoader.defineClass(URLClassLoader.java:251) at java.net.URLClassLoader.access$100(URLClassLoader.java:55) at java.net.URLClassLoader$1.run(URLClassLoader.java:194) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:187) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:141) I'm trying to run it with 1.4. thanks Ricardo From taj at www.linux.org.uk Tue Apr 5 00:48:12 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 07:48:12 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42515A83.4050907@emation.pt> References: <42515A83.4050907@emation.pt> Message-ID: On Mon, 4 Apr 2005, Ricardo Trindade wrote: > Hi, > > I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most > recent stable snapshot), and get the following exception : > > It looks like rxtx has been compiled with jdk 1.5. If this was > indeed the case, I think there is a compilation flag that generates code > that runs on older jdks. > > java.lang.UnsupportedClassVersionError: > gnu/io/UnsupportedCommOperationException (Unsupported major.minor > version 49.0) [snip] Thanks Ricardo I recompiled the jar with javac -source 1.3 -target 1.3. That should cover most of the JRE's in use today. I also compiled the rxtx 2.0 x86_64 native library which appeared to be missing. I tried looking for flags to pass gcc 4.0 to make the native libraries more backwards compatible but only found options for C++ which is not used in rxtx. I've got a list of other bugs that I'll be going through in the next few weeks but for now I just left them with the same CVS filename - no code changes. ftp://ftp.qbang.org/pub/rxtx/rxtx-2.0-CVS-20050120-bins.tar.gz ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-CVS-20050120-bins.tar.gz -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Tue Apr 5 02:24:33 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 05 Apr 2005 09:24:33 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: References: <42515A83.4050907@emation.pt> Message-ID: <42524B41.3040300@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050405/5919abbb/attachment-0034.html From taj at www.linux.org.uk Tue Apr 5 03:00:29 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 10:00:29 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42524B41.3040300@emation.pt> References: <42515A83.4050907@emation.pt> <42524B41.3040300@emation.pt> Message-ID: On Tue, 5 Apr 2005, Ricardo Trindade wrote: > Will you anounce to the list when a new release is available ? > There will be several incremental releases announced here. Once those are done, we will release 2.1.7 and 2.0.7. -- Trent Jarvi taj at www.linux.org.uk From no_spam at somewhere.com Tue Apr 5 11:55:37 2005 From: no_spam at somewhere.com (no_spam@somewhere.com) Date: Tue, 5 Apr 2005 13:55:37 -0400 Subject: [Rxtx] Closing a port from an event listener results in a deadlock Message-ID: <20050405175537.GA21747@rcog.homelinux.net> On the message I sent on March 14, does anyone had the chance to try the modification? Or was it already fixed? (I haven't searched the archive extensively) Or maybe my message got catched by some spam filters? (it made it to the list archive though) Anyway, I would appreciate some feedback (through the list) Thanks From taj at www.linux.org.uk Tue Apr 5 14:42:28 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 21:42:28 +0100 (BST) Subject: [Rxtx] Closing a port from an event listener results in a deadlock In-Reply-To: <20050405175537.GA21747@rcog.homelinux.net> References: <20050405175537.GA21747@rcog.homelinux.net> Message-ID: On Tue, 5 Apr 2005 no_spam at somewhere.com wrote: > On the message I sent on March 14, does anyone had the chance to try the > modification? > > Or was it already fixed? (I haven't searched the archive extensively) > > Or maybe my message got catched by some spam filters? (it made it to the list > archive though) > > Anyway, I would appreciate some feedback (through the list) > The patch is here http://marc.theaimsgroup.com/?l=rxtx&m=111084488820288&w=2 I have applied this patch to a local copy but will not be doing formal testing for a couple weeks. I do not try to close ports from inside the eventListenter usually so I encourage any feedback also. If there are no problems reported, I expect this will go into rxtx 2.1-7. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Wed Apr 6 08:33:42 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Wed, 06 Apr 2005 15:33:42 +0100 Subject: [Rxtx] getting RXTX version Message-ID: <4253F346.50102@emation.pt> Hi, I want to make sure my deployments have the same version of RXTX jar and native lib. I know the version of the jar can be obtained in the Version class, but how can I obtain the native version ? I know RXTX prints to the console a warning if the version is different. Is there a way to programatically know is this is the case ? I would like to log that to our app's log thanks Ricardo From taj at www.linux.org.uk Wed Apr 6 15:10:20 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 6 Apr 2005 22:10:20 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4253F346.50102@emation.pt> References: <4253F346.50102@emation.pt> Message-ID: On Wed, 6 Apr 2005, Ricardo Trindade wrote: > Hi, > > I want to make sure my deployments have the same version of RXTX jar > and native lib. > > I know the version of the jar can be obtained in the Version class, > but how can I obtain the native version ? > > I know RXTX prints to the console a warning if the version is > different. Is there a way to programatically know is this is the case ? > > I would like to log that to our app's log > There isn't a suggested way of doing that right now. We could move things around and have a static String RXTXVersion.getNativeVersion() in future releases. Is this what you expected? This is not documented in commapi at all. I just tossed that in to catch conflicts while developing. It would be nice to have access in GUI applications though. It may be possible to access RXTXCommDriver.LibVersion right now. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Thu Apr 7 02:51:00 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 09:51:00 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> Message-ID: <4254F474.7020905@emation.pt> >There isn't a suggested way of doing that right now. We could move things >around and have a static String RXTXVersion.getNativeVersion() in future >releases. Is this what you expected? > > Yes, that would be perfect. >This is not documented in commapi at all. I just tossed that in to catch >conflicts while developing. It would be nice to have access in GUI >applications though. > >It may be possible to access RXTXCommDriver.LibVersion right now. > > > I tried, and I don't think it's possible. From taj at www.linux.org.uk Thu Apr 7 03:32:04 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 7 Apr 2005 10:32:04 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4254F474.7020905@emation.pt> References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: On Thu, 7 Apr 2005, Ricardo Trindade wrote: > > >There isn't a suggested way of doing that right now. We could move things > >around and have a static String RXTXVersion.getNativeVersion() in future > >releases. Is this what you expected? > > > > > > Yes, that would be perfect. > The attached should do what you want. You will still need to catch an exception for older versions... -- Trent Jarvi taj at www.linux.org.uk -------------- next part -------------- ? public_version.patch Index: RXTXCommDriver.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXCommDriver.java,v retrieving revision 1.16.2.51 diff -u -r1.16.2.51 RXTXCommDriver.java --- RXTXCommDriver.java 12 Oct 2004 09:13:30 -0000 1.16.2.51 +++ RXTXCommDriver.java 7 Apr 2005 09:29:04 -0000 @@ -54,7 +54,7 @@ the Library. */ String JarVersion = RXTXVersion.getVersion(); - String LibVersion = nativeGetVersion(); + String LibVersion = RXTXVersion.nativeGetVersion(); if ( devel ) { System.out.println("Devel Library"); @@ -76,7 +76,6 @@ /** Get the Serial port prefixes for the running OS */ private String deviceDirectory; private String osName; - private static native String nativeGetVersion(); private native boolean registerKnownPorts(int PortType); private native boolean isPortPrefixValid(String dev); private native boolean testRead(String dev, int type); Index: RXTXVersion.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXVersion.java,v retrieving revision 1.2.2.31 diff -u -r1.2.2.31 RXTXVersion.java --- RXTXVersion.java 16 Oct 2004 16:20:35 -0000 1.2.2.31 +++ RXTXVersion.java 7 Apr 2005 09:29:04 -0000 @@ -36,6 +36,7 @@ private static String Version; static { + System.loadLibrary( "rxtxSerial" ); Version = "RXTX-2.1-7pre20"; } /** @@ -47,4 +48,5 @@ { return(Version); } + public static native String nativeGetVersion(); } Index: SerialImp.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v retrieving revision 1.46.2.181 diff -u -r1.46.2.181 SerialImp.c --- SerialImp.c 17 Oct 2004 09:48:56 -0000 1.46.2.181 +++ SerialImp.c 7 Apr 2005 09:29:07 -0000 @@ -116,6 +116,7 @@ * It will eventually be removed. * */ #define RXTXPort(foo) Java_gnu_io_RXTXPort_ ## foo +#define RXTXVersion(foo) Java_gnu_io_RXTXVersion_ ## foo #define RXTXCommDriver(foo) Java_gnu_io_RXTXCommDriver_ ## foo #if defined(__sun__) || defined(__hpux__) @@ -4001,7 +4002,7 @@ } /*---------------------------------------------------------- -RXTXCommDriver.nativeGetVersion +RXTXVersion.nativeGetVersion accept: none perform: return the current version @@ -4010,9 +4011,10 @@ comments: This is used to avoid mixing versions of the .jar and native library. First introduced in rxtx-1.5-9 + Moved from RXTXCommDriver to RXTXVersion in rxtx-2.1-7 ----------------------------------------------------------*/ -JNIEXPORT jstring JNICALL RXTXCommDriver(nativeGetVersion) (JNIEnv *env, +JNIEXPORT jstring JNICALL RXTXVersion(nativeGetVersion) (JNIEnv *env, jclass jclazz ) { return (*env)->NewStringUTF( env, "RXTX-2.1-7pre20" ); From ricardo.trindade at emation.pt Thu Apr 7 03:45:58 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 10:45:58 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: <42550156.2040908@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050407/05212451/attachment-0034.html From thomas.shulok at lmco.com Thu Apr 7 17:43:11 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Thu, 07 Apr 2005 19:43:11 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi There, I'm attempting to talk RS232 between an embedded Linux box and a Windows box. Everything connects up fine, and I can send and receive a simple sequence of bytes with no problems. However, if around 5 seconds goes by without me sending something, I get the following when I attempt to send. java.io.IOException: Input/output error in writeArray Stack trace: java/lang/Throwable.()V java/lang/Throwable.(Ljava/lang/String;)V java/io/IOException.(Ljava/lang/String;)V gnu/io/RXTXPort.writeArray([BIIZ)V gnu/io/RXTXPort$SerialOutputStream.write([B)V SerialTest.main([Ljava/lang/String;)V If there interval is shorter (say 2 seconds between sends), I have no problems. On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and librxtxSerial-2.0.7pre2.so. Any ideas? Thanks, Thom -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5b23dcf/attachment-0034.html From taj at www.linux.org.uk Thu Apr 7 19:22:36 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:22:36 +0100 (BST) Subject: [Rxtx] Input/output error in writeArray In-Reply-To: References: Message-ID: On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a Windows > box. Everything connects up fine, and I can send and receive a simple > sequence of bytes with no problems. However, if around 5 seconds goes > by without me sending something, I get the following when I attempt to > send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Apr 7 19:24:59 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:24:59 +0100 (BST) Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) Message-ID: hmm. This would not work from applets would it? -- Trent Jarvi taj at www.linux.org.uk ---------- Forwarded message ---------- Date: Thu, 07 Apr 2005 16:05:53 -0400 From: Chris Gaffney To: taj at www.linux.org.uk Subject: RXTX Libraries on Classpath fix Hi, I submitted a patch for RXTX a few weeks ago to allow for loading the native libraries from the classpath. Since sending it to you I found it wasn't working on windows. I've fixed the problem and created a new patch that should replace the older one. The actual change is a one line from a String.equals() to a String.startsWith(). Thanks for a great piece of software, -Chris Gaffney Grand Valley State University -------------- next part -------------- A non-text attachment was scrubbed... Name: libraries_on_classpath_fixed.patch Type: text/x-patch Size: 5617 bytes Desc: Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5d423b8/libraries_on_classpath_fixed-0034.bin From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From thomas.shulok at lmco.com Fri Apr 8 10:38:55 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Fri, 08 Apr 2005 12:38:55 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi Trent, Thanks for the prompt response. Before diving deeper, I was wondering if there is a timeout parameter somewhere in the stack that I have not set properly. Given the nature of the failure (only fails if the line has been idle for a few seconds), it feels like some kind of timeout issue... Thanks again, Thom -----Original Message----- From: rxtx-bounces at mail.linuxgrrls.org [mailto:rxtx-bounces at mail.linuxgrrls.org] On Behalf Of Trent Jarvi Sent: Thursday, April 07, 2005 6:23 PM To: Java RXTX discussion Subject: Re: [Rxtx] Input/output error in writeArray On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a > Windows box. Everything connects up fine, and I can send and receive > a simple sequence of bytes with no problems. However, if around 5 > seconds goes by without me sending something, I get the following when > I attempt to send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at mail.linuxgrrls.org http://mail.linuxgrrls.org/mailman/listinfo/rxtx From ricardo.trindade at emation.pt Mon Apr 4 09:17:23 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Mon, 04 Apr 2005 16:17:23 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot Message-ID: <42515A83.4050907@emation.pt> Hi, I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most recent stable snapshot), and get the following exception : It looks like rxtx has been compiled with jdk 1.5. If this was indeed the case, I think there is a compilation flag that generates code that runs on older jdks. java.lang.UnsupportedClassVersionError: gnu/io/UnsupportedCommOperationException (Unsupported major.minor version 49.0) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at java.net.URLClassLoader.defineClass(URLClassLoader.java:251) at java.net.URLClassLoader.access$100(URLClassLoader.java:55) at java.net.URLClassLoader$1.run(URLClassLoader.java:194) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:187) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:141) I'm trying to run it with 1.4. thanks Ricardo From taj at www.linux.org.uk Tue Apr 5 00:48:12 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 07:48:12 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42515A83.4050907@emation.pt> References: <42515A83.4050907@emation.pt> Message-ID: On Mon, 4 Apr 2005, Ricardo Trindade wrote: > Hi, > > I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most > recent stable snapshot), and get the following exception : > > It looks like rxtx has been compiled with jdk 1.5. If this was > indeed the case, I think there is a compilation flag that generates code > that runs on older jdks. > > java.lang.UnsupportedClassVersionError: > gnu/io/UnsupportedCommOperationException (Unsupported major.minor > version 49.0) [snip] Thanks Ricardo I recompiled the jar with javac -source 1.3 -target 1.3. That should cover most of the JRE's in use today. I also compiled the rxtx 2.0 x86_64 native library which appeared to be missing. I tried looking for flags to pass gcc 4.0 to make the native libraries more backwards compatible but only found options for C++ which is not used in rxtx. I've got a list of other bugs that I'll be going through in the next few weeks but for now I just left them with the same CVS filename - no code changes. ftp://ftp.qbang.org/pub/rxtx/rxtx-2.0-CVS-20050120-bins.tar.gz ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-CVS-20050120-bins.tar.gz -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Tue Apr 5 02:24:33 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 05 Apr 2005 09:24:33 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: References: <42515A83.4050907@emation.pt> Message-ID: <42524B41.3040300@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050405/5919abbb/attachment-0035.html From taj at www.linux.org.uk Tue Apr 5 03:00:29 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 10:00:29 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42524B41.3040300@emation.pt> References: <42515A83.4050907@emation.pt> <42524B41.3040300@emation.pt> Message-ID: On Tue, 5 Apr 2005, Ricardo Trindade wrote: > Will you anounce to the list when a new release is available ? > There will be several incremental releases announced here. Once those are done, we will release 2.1.7 and 2.0.7. -- Trent Jarvi taj at www.linux.org.uk From no_spam at somewhere.com Tue Apr 5 11:55:37 2005 From: no_spam at somewhere.com (no_spam@somewhere.com) Date: Tue, 5 Apr 2005 13:55:37 -0400 Subject: [Rxtx] Closing a port from an event listener results in a deadlock Message-ID: <20050405175537.GA21747@rcog.homelinux.net> On the message I sent on March 14, does anyone had the chance to try the modification? Or was it already fixed? (I haven't searched the archive extensively) Or maybe my message got catched by some spam filters? (it made it to the list archive though) Anyway, I would appreciate some feedback (through the list) Thanks From taj at www.linux.org.uk Tue Apr 5 14:42:28 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 21:42:28 +0100 (BST) Subject: [Rxtx] Closing a port from an event listener results in a deadlock In-Reply-To: <20050405175537.GA21747@rcog.homelinux.net> References: <20050405175537.GA21747@rcog.homelinux.net> Message-ID: On Tue, 5 Apr 2005 no_spam at somewhere.com wrote: > On the message I sent on March 14, does anyone had the chance to try the > modification? > > Or was it already fixed? (I haven't searched the archive extensively) > > Or maybe my message got catched by some spam filters? (it made it to the list > archive though) > > Anyway, I would appreciate some feedback (through the list) > The patch is here http://marc.theaimsgroup.com/?l=rxtx&m=111084488820288&w=2 I have applied this patch to a local copy but will not be doing formal testing for a couple weeks. I do not try to close ports from inside the eventListenter usually so I encourage any feedback also. If there are no problems reported, I expect this will go into rxtx 2.1-7. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Wed Apr 6 08:33:42 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Wed, 06 Apr 2005 15:33:42 +0100 Subject: [Rxtx] getting RXTX version Message-ID: <4253F346.50102@emation.pt> Hi, I want to make sure my deployments have the same version of RXTX jar and native lib. I know the version of the jar can be obtained in the Version class, but how can I obtain the native version ? I know RXTX prints to the console a warning if the version is different. Is there a way to programatically know is this is the case ? I would like to log that to our app's log thanks Ricardo From taj at www.linux.org.uk Wed Apr 6 15:10:20 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 6 Apr 2005 22:10:20 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4253F346.50102@emation.pt> References: <4253F346.50102@emation.pt> Message-ID: On Wed, 6 Apr 2005, Ricardo Trindade wrote: > Hi, > > I want to make sure my deployments have the same version of RXTX jar > and native lib. > > I know the version of the jar can be obtained in the Version class, > but how can I obtain the native version ? > > I know RXTX prints to the console a warning if the version is > different. Is there a way to programatically know is this is the case ? > > I would like to log that to our app's log > There isn't a suggested way of doing that right now. We could move things around and have a static String RXTXVersion.getNativeVersion() in future releases. Is this what you expected? This is not documented in commapi at all. I just tossed that in to catch conflicts while developing. It would be nice to have access in GUI applications though. It may be possible to access RXTXCommDriver.LibVersion right now. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Thu Apr 7 02:51:00 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 09:51:00 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> Message-ID: <4254F474.7020905@emation.pt> >There isn't a suggested way of doing that right now. We could move things >around and have a static String RXTXVersion.getNativeVersion() in future >releases. Is this what you expected? > > Yes, that would be perfect. >This is not documented in commapi at all. I just tossed that in to catch >conflicts while developing. It would be nice to have access in GUI >applications though. > >It may be possible to access RXTXCommDriver.LibVersion right now. > > > I tried, and I don't think it's possible. From taj at www.linux.org.uk Thu Apr 7 03:32:04 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 7 Apr 2005 10:32:04 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4254F474.7020905@emation.pt> References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: On Thu, 7 Apr 2005, Ricardo Trindade wrote: > > >There isn't a suggested way of doing that right now. We could move things > >around and have a static String RXTXVersion.getNativeVersion() in future > >releases. Is this what you expected? > > > > > > Yes, that would be perfect. > The attached should do what you want. You will still need to catch an exception for older versions... -- Trent Jarvi taj at www.linux.org.uk -------------- next part -------------- ? public_version.patch Index: RXTXCommDriver.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXCommDriver.java,v retrieving revision 1.16.2.51 diff -u -r1.16.2.51 RXTXCommDriver.java --- RXTXCommDriver.java 12 Oct 2004 09:13:30 -0000 1.16.2.51 +++ RXTXCommDriver.java 7 Apr 2005 09:29:04 -0000 @@ -54,7 +54,7 @@ the Library. */ String JarVersion = RXTXVersion.getVersion(); - String LibVersion = nativeGetVersion(); + String LibVersion = RXTXVersion.nativeGetVersion(); if ( devel ) { System.out.println("Devel Library"); @@ -76,7 +76,6 @@ /** Get the Serial port prefixes for the running OS */ private String deviceDirectory; private String osName; - private static native String nativeGetVersion(); private native boolean registerKnownPorts(int PortType); private native boolean isPortPrefixValid(String dev); private native boolean testRead(String dev, int type); Index: RXTXVersion.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXVersion.java,v retrieving revision 1.2.2.31 diff -u -r1.2.2.31 RXTXVersion.java --- RXTXVersion.java 16 Oct 2004 16:20:35 -0000 1.2.2.31 +++ RXTXVersion.java 7 Apr 2005 09:29:04 -0000 @@ -36,6 +36,7 @@ private static String Version; static { + System.loadLibrary( "rxtxSerial" ); Version = "RXTX-2.1-7pre20"; } /** @@ -47,4 +48,5 @@ { return(Version); } + public static native String nativeGetVersion(); } Index: SerialImp.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v retrieving revision 1.46.2.181 diff -u -r1.46.2.181 SerialImp.c --- SerialImp.c 17 Oct 2004 09:48:56 -0000 1.46.2.181 +++ SerialImp.c 7 Apr 2005 09:29:07 -0000 @@ -116,6 +116,7 @@ * It will eventually be removed. * */ #define RXTXPort(foo) Java_gnu_io_RXTXPort_ ## foo +#define RXTXVersion(foo) Java_gnu_io_RXTXVersion_ ## foo #define RXTXCommDriver(foo) Java_gnu_io_RXTXCommDriver_ ## foo #if defined(__sun__) || defined(__hpux__) @@ -4001,7 +4002,7 @@ } /*---------------------------------------------------------- -RXTXCommDriver.nativeGetVersion +RXTXVersion.nativeGetVersion accept: none perform: return the current version @@ -4010,9 +4011,10 @@ comments: This is used to avoid mixing versions of the .jar and native library. First introduced in rxtx-1.5-9 + Moved from RXTXCommDriver to RXTXVersion in rxtx-2.1-7 ----------------------------------------------------------*/ -JNIEXPORT jstring JNICALL RXTXCommDriver(nativeGetVersion) (JNIEnv *env, +JNIEXPORT jstring JNICALL RXTXVersion(nativeGetVersion) (JNIEnv *env, jclass jclazz ) { return (*env)->NewStringUTF( env, "RXTX-2.1-7pre20" ); From ricardo.trindade at emation.pt Thu Apr 7 03:45:58 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 10:45:58 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: <42550156.2040908@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050407/05212451/attachment-0035.html From thomas.shulok at lmco.com Thu Apr 7 17:43:11 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Thu, 07 Apr 2005 19:43:11 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi There, I'm attempting to talk RS232 between an embedded Linux box and a Windows box. Everything connects up fine, and I can send and receive a simple sequence of bytes with no problems. However, if around 5 seconds goes by without me sending something, I get the following when I attempt to send. java.io.IOException: Input/output error in writeArray Stack trace: java/lang/Throwable.()V java/lang/Throwable.(Ljava/lang/String;)V java/io/IOException.(Ljava/lang/String;)V gnu/io/RXTXPort.writeArray([BIIZ)V gnu/io/RXTXPort$SerialOutputStream.write([B)V SerialTest.main([Ljava/lang/String;)V If there interval is shorter (say 2 seconds between sends), I have no problems. On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and librxtxSerial-2.0.7pre2.so. Any ideas? Thanks, Thom -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5b23dcf/attachment-0035.html From taj at www.linux.org.uk Thu Apr 7 19:22:36 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:22:36 +0100 (BST) Subject: [Rxtx] Input/output error in writeArray In-Reply-To: References: Message-ID: On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a Windows > box. Everything connects up fine, and I can send and receive a simple > sequence of bytes with no problems. However, if around 5 seconds goes > by without me sending something, I get the following when I attempt to > send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Apr 7 19:24:59 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:24:59 +0100 (BST) Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) Message-ID: hmm. This would not work from applets would it? -- Trent Jarvi taj at www.linux.org.uk ---------- Forwarded message ---------- Date: Thu, 07 Apr 2005 16:05:53 -0400 From: Chris Gaffney To: taj at www.linux.org.uk Subject: RXTX Libraries on Classpath fix Hi, I submitted a patch for RXTX a few weeks ago to allow for loading the native libraries from the classpath. Since sending it to you I found it wasn't working on windows. I've fixed the problem and created a new patch that should replace the older one. The actual change is a one line from a String.equals() to a String.startsWith(). Thanks for a great piece of software, -Chris Gaffney Grand Valley State University -------------- next part -------------- A non-text attachment was scrubbed... Name: libraries_on_classpath_fixed.patch Type: text/x-patch Size: 5617 bytes Desc: Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5d423b8/libraries_on_classpath_fixed-0035.bin From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From thomas.shulok at lmco.com Fri Apr 8 10:38:55 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Fri, 08 Apr 2005 12:38:55 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi Trent, Thanks for the prompt response. Before diving deeper, I was wondering if there is a timeout parameter somewhere in the stack that I have not set properly. Given the nature of the failure (only fails if the line has been idle for a few seconds), it feels like some kind of timeout issue... Thanks again, Thom -----Original Message----- From: rxtx-bounces at mail.linuxgrrls.org [mailto:rxtx-bounces at mail.linuxgrrls.org] On Behalf Of Trent Jarvi Sent: Thursday, April 07, 2005 6:23 PM To: Java RXTX discussion Subject: Re: [Rxtx] Input/output error in writeArray On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a > Windows box. Everything connects up fine, and I can send and receive > a simple sequence of bytes with no problems. However, if around 5 > seconds goes by without me sending something, I get the following when > I attempt to send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at mail.linuxgrrls.org http://mail.linuxgrrls.org/mailman/listinfo/rxtx From ricardo.trindade at emation.pt Mon Apr 4 09:17:23 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Mon, 04 Apr 2005 16:17:23 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot Message-ID: <42515A83.4050907@emation.pt> Hi, I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most recent stable snapshot), and get the following exception : It looks like rxtx has been compiled with jdk 1.5. If this was indeed the case, I think there is a compilation flag that generates code that runs on older jdks. java.lang.UnsupportedClassVersionError: gnu/io/UnsupportedCommOperationException (Unsupported major.minor version 49.0) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at java.net.URLClassLoader.defineClass(URLClassLoader.java:251) at java.net.URLClassLoader.access$100(URLClassLoader.java:55) at java.net.URLClassLoader$1.run(URLClassLoader.java:194) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:187) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:141) I'm trying to run it with 1.4. thanks Ricardo From taj at www.linux.org.uk Tue Apr 5 00:48:12 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 07:48:12 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42515A83.4050907@emation.pt> References: <42515A83.4050907@emation.pt> Message-ID: On Mon, 4 Apr 2005, Ricardo Trindade wrote: > Hi, > > I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most > recent stable snapshot), and get the following exception : > > It looks like rxtx has been compiled with jdk 1.5. If this was > indeed the case, I think there is a compilation flag that generates code > that runs on older jdks. > > java.lang.UnsupportedClassVersionError: > gnu/io/UnsupportedCommOperationException (Unsupported major.minor > version 49.0) [snip] Thanks Ricardo I recompiled the jar with javac -source 1.3 -target 1.3. That should cover most of the JRE's in use today. I also compiled the rxtx 2.0 x86_64 native library which appeared to be missing. I tried looking for flags to pass gcc 4.0 to make the native libraries more backwards compatible but only found options for C++ which is not used in rxtx. I've got a list of other bugs that I'll be going through in the next few weeks but for now I just left them with the same CVS filename - no code changes. ftp://ftp.qbang.org/pub/rxtx/rxtx-2.0-CVS-20050120-bins.tar.gz ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-CVS-20050120-bins.tar.gz -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Tue Apr 5 02:24:33 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 05 Apr 2005 09:24:33 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: References: <42515A83.4050907@emation.pt> Message-ID: <42524B41.3040300@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050405/5919abbb/attachment-0036.html From taj at www.linux.org.uk Tue Apr 5 03:00:29 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 10:00:29 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42524B41.3040300@emation.pt> References: <42515A83.4050907@emation.pt> <42524B41.3040300@emation.pt> Message-ID: On Tue, 5 Apr 2005, Ricardo Trindade wrote: > Will you anounce to the list when a new release is available ? > There will be several incremental releases announced here. Once those are done, we will release 2.1.7 and 2.0.7. -- Trent Jarvi taj at www.linux.org.uk From no_spam at somewhere.com Tue Apr 5 11:55:37 2005 From: no_spam at somewhere.com (no_spam@somewhere.com) Date: Tue, 5 Apr 2005 13:55:37 -0400 Subject: [Rxtx] Closing a port from an event listener results in a deadlock Message-ID: <20050405175537.GA21747@rcog.homelinux.net> On the message I sent on March 14, does anyone had the chance to try the modification? Or was it already fixed? (I haven't searched the archive extensively) Or maybe my message got catched by some spam filters? (it made it to the list archive though) Anyway, I would appreciate some feedback (through the list) Thanks From taj at www.linux.org.uk Tue Apr 5 14:42:28 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 21:42:28 +0100 (BST) Subject: [Rxtx] Closing a port from an event listener results in a deadlock In-Reply-To: <20050405175537.GA21747@rcog.homelinux.net> References: <20050405175537.GA21747@rcog.homelinux.net> Message-ID: On Tue, 5 Apr 2005 no_spam at somewhere.com wrote: > On the message I sent on March 14, does anyone had the chance to try the > modification? > > Or was it already fixed? (I haven't searched the archive extensively) > > Or maybe my message got catched by some spam filters? (it made it to the list > archive though) > > Anyway, I would appreciate some feedback (through the list) > The patch is here http://marc.theaimsgroup.com/?l=rxtx&m=111084488820288&w=2 I have applied this patch to a local copy but will not be doing formal testing for a couple weeks. I do not try to close ports from inside the eventListenter usually so I encourage any feedback also. If there are no problems reported, I expect this will go into rxtx 2.1-7. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Wed Apr 6 08:33:42 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Wed, 06 Apr 2005 15:33:42 +0100 Subject: [Rxtx] getting RXTX version Message-ID: <4253F346.50102@emation.pt> Hi, I want to make sure my deployments have the same version of RXTX jar and native lib. I know the version of the jar can be obtained in the Version class, but how can I obtain the native version ? I know RXTX prints to the console a warning if the version is different. Is there a way to programatically know is this is the case ? I would like to log that to our app's log thanks Ricardo From taj at www.linux.org.uk Wed Apr 6 15:10:20 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 6 Apr 2005 22:10:20 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4253F346.50102@emation.pt> References: <4253F346.50102@emation.pt> Message-ID: On Wed, 6 Apr 2005, Ricardo Trindade wrote: > Hi, > > I want to make sure my deployments have the same version of RXTX jar > and native lib. > > I know the version of the jar can be obtained in the Version class, > but how can I obtain the native version ? > > I know RXTX prints to the console a warning if the version is > different. Is there a way to programatically know is this is the case ? > > I would like to log that to our app's log > There isn't a suggested way of doing that right now. We could move things around and have a static String RXTXVersion.getNativeVersion() in future releases. Is this what you expected? This is not documented in commapi at all. I just tossed that in to catch conflicts while developing. It would be nice to have access in GUI applications though. It may be possible to access RXTXCommDriver.LibVersion right now. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Thu Apr 7 02:51:00 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 09:51:00 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> Message-ID: <4254F474.7020905@emation.pt> >There isn't a suggested way of doing that right now. We could move things >around and have a static String RXTXVersion.getNativeVersion() in future >releases. Is this what you expected? > > Yes, that would be perfect. >This is not documented in commapi at all. I just tossed that in to catch >conflicts while developing. It would be nice to have access in GUI >applications though. > >It may be possible to access RXTXCommDriver.LibVersion right now. > > > I tried, and I don't think it's possible. From taj at www.linux.org.uk Thu Apr 7 03:32:04 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 7 Apr 2005 10:32:04 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4254F474.7020905@emation.pt> References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: On Thu, 7 Apr 2005, Ricardo Trindade wrote: > > >There isn't a suggested way of doing that right now. We could move things > >around and have a static String RXTXVersion.getNativeVersion() in future > >releases. Is this what you expected? > > > > > > Yes, that would be perfect. > The attached should do what you want. You will still need to catch an exception for older versions... -- Trent Jarvi taj at www.linux.org.uk -------------- next part -------------- ? public_version.patch Index: RXTXCommDriver.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXCommDriver.java,v retrieving revision 1.16.2.51 diff -u -r1.16.2.51 RXTXCommDriver.java --- RXTXCommDriver.java 12 Oct 2004 09:13:30 -0000 1.16.2.51 +++ RXTXCommDriver.java 7 Apr 2005 09:29:04 -0000 @@ -54,7 +54,7 @@ the Library. */ String JarVersion = RXTXVersion.getVersion(); - String LibVersion = nativeGetVersion(); + String LibVersion = RXTXVersion.nativeGetVersion(); if ( devel ) { System.out.println("Devel Library"); @@ -76,7 +76,6 @@ /** Get the Serial port prefixes for the running OS */ private String deviceDirectory; private String osName; - private static native String nativeGetVersion(); private native boolean registerKnownPorts(int PortType); private native boolean isPortPrefixValid(String dev); private native boolean testRead(String dev, int type); Index: RXTXVersion.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXVersion.java,v retrieving revision 1.2.2.31 diff -u -r1.2.2.31 RXTXVersion.java --- RXTXVersion.java 16 Oct 2004 16:20:35 -0000 1.2.2.31 +++ RXTXVersion.java 7 Apr 2005 09:29:04 -0000 @@ -36,6 +36,7 @@ private static String Version; static { + System.loadLibrary( "rxtxSerial" ); Version = "RXTX-2.1-7pre20"; } /** @@ -47,4 +48,5 @@ { return(Version); } + public static native String nativeGetVersion(); } Index: SerialImp.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v retrieving revision 1.46.2.181 diff -u -r1.46.2.181 SerialImp.c --- SerialImp.c 17 Oct 2004 09:48:56 -0000 1.46.2.181 +++ SerialImp.c 7 Apr 2005 09:29:07 -0000 @@ -116,6 +116,7 @@ * It will eventually be removed. * */ #define RXTXPort(foo) Java_gnu_io_RXTXPort_ ## foo +#define RXTXVersion(foo) Java_gnu_io_RXTXVersion_ ## foo #define RXTXCommDriver(foo) Java_gnu_io_RXTXCommDriver_ ## foo #if defined(__sun__) || defined(__hpux__) @@ -4001,7 +4002,7 @@ } /*---------------------------------------------------------- -RXTXCommDriver.nativeGetVersion +RXTXVersion.nativeGetVersion accept: none perform: return the current version @@ -4010,9 +4011,10 @@ comments: This is used to avoid mixing versions of the .jar and native library. First introduced in rxtx-1.5-9 + Moved from RXTXCommDriver to RXTXVersion in rxtx-2.1-7 ----------------------------------------------------------*/ -JNIEXPORT jstring JNICALL RXTXCommDriver(nativeGetVersion) (JNIEnv *env, +JNIEXPORT jstring JNICALL RXTXVersion(nativeGetVersion) (JNIEnv *env, jclass jclazz ) { return (*env)->NewStringUTF( env, "RXTX-2.1-7pre20" ); From ricardo.trindade at emation.pt Thu Apr 7 03:45:58 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 10:45:58 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: <42550156.2040908@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050407/05212451/attachment-0036.html From thomas.shulok at lmco.com Thu Apr 7 17:43:11 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Thu, 07 Apr 2005 19:43:11 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi There, I'm attempting to talk RS232 between an embedded Linux box and a Windows box. Everything connects up fine, and I can send and receive a simple sequence of bytes with no problems. However, if around 5 seconds goes by without me sending something, I get the following when I attempt to send. java.io.IOException: Input/output error in writeArray Stack trace: java/lang/Throwable.()V java/lang/Throwable.(Ljava/lang/String;)V java/io/IOException.(Ljava/lang/String;)V gnu/io/RXTXPort.writeArray([BIIZ)V gnu/io/RXTXPort$SerialOutputStream.write([B)V SerialTest.main([Ljava/lang/String;)V If there interval is shorter (say 2 seconds between sends), I have no problems. On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and librxtxSerial-2.0.7pre2.so. Any ideas? Thanks, Thom -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5b23dcf/attachment-0036.html From taj at www.linux.org.uk Thu Apr 7 19:22:36 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:22:36 +0100 (BST) Subject: [Rxtx] Input/output error in writeArray In-Reply-To: References: Message-ID: On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a Windows > box. Everything connects up fine, and I can send and receive a simple > sequence of bytes with no problems. However, if around 5 seconds goes > by without me sending something, I get the following when I attempt to > send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Apr 7 19:24:59 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:24:59 +0100 (BST) Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) Message-ID: hmm. This would not work from applets would it? -- Trent Jarvi taj at www.linux.org.uk ---------- Forwarded message ---------- Date: Thu, 07 Apr 2005 16:05:53 -0400 From: Chris Gaffney To: taj at www.linux.org.uk Subject: RXTX Libraries on Classpath fix Hi, I submitted a patch for RXTX a few weeks ago to allow for loading the native libraries from the classpath. Since sending it to you I found it wasn't working on windows. I've fixed the problem and created a new patch that should replace the older one. The actual change is a one line from a String.equals() to a String.startsWith(). Thanks for a great piece of software, -Chris Gaffney Grand Valley State University -------------- next part -------------- A non-text attachment was scrubbed... Name: libraries_on_classpath_fixed.patch Type: text/x-patch Size: 5617 bytes Desc: Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5d423b8/libraries_on_classpath_fixed-0036.bin From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From thomas.shulok at lmco.com Fri Apr 8 10:38:55 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Fri, 08 Apr 2005 12:38:55 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi Trent, Thanks for the prompt response. Before diving deeper, I was wondering if there is a timeout parameter somewhere in the stack that I have not set properly. Given the nature of the failure (only fails if the line has been idle for a few seconds), it feels like some kind of timeout issue... Thanks again, Thom -----Original Message----- From: rxtx-bounces at mail.linuxgrrls.org [mailto:rxtx-bounces at mail.linuxgrrls.org] On Behalf Of Trent Jarvi Sent: Thursday, April 07, 2005 6:23 PM To: Java RXTX discussion Subject: Re: [Rxtx] Input/output error in writeArray On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a > Windows box. Everything connects up fine, and I can send and receive > a simple sequence of bytes with no problems. However, if around 5 > seconds goes by without me sending something, I get the following when > I attempt to send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at mail.linuxgrrls.org http://mail.linuxgrrls.org/mailman/listinfo/rxtx From ricardo.trindade at emation.pt Mon Apr 4 09:17:23 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Mon, 04 Apr 2005 16:17:23 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot Message-ID: <42515A83.4050907@emation.pt> Hi, I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most recent stable snapshot), and get the following exception : It looks like rxtx has been compiled with jdk 1.5. If this was indeed the case, I think there is a compilation flag that generates code that runs on older jdks. java.lang.UnsupportedClassVersionError: gnu/io/UnsupportedCommOperationException (Unsupported major.minor version 49.0) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at java.net.URLClassLoader.defineClass(URLClassLoader.java:251) at java.net.URLClassLoader.access$100(URLClassLoader.java:55) at java.net.URLClassLoader$1.run(URLClassLoader.java:194) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:187) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:141) I'm trying to run it with 1.4. thanks Ricardo From taj at www.linux.org.uk Tue Apr 5 00:48:12 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 07:48:12 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42515A83.4050907@emation.pt> References: <42515A83.4050907@emation.pt> Message-ID: On Mon, 4 Apr 2005, Ricardo Trindade wrote: > Hi, > > I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most > recent stable snapshot), and get the following exception : > > It looks like rxtx has been compiled with jdk 1.5. If this was > indeed the case, I think there is a compilation flag that generates code > that runs on older jdks. > > java.lang.UnsupportedClassVersionError: > gnu/io/UnsupportedCommOperationException (Unsupported major.minor > version 49.0) [snip] Thanks Ricardo I recompiled the jar with javac -source 1.3 -target 1.3. That should cover most of the JRE's in use today. I also compiled the rxtx 2.0 x86_64 native library which appeared to be missing. I tried looking for flags to pass gcc 4.0 to make the native libraries more backwards compatible but only found options for C++ which is not used in rxtx. I've got a list of other bugs that I'll be going through in the next few weeks but for now I just left them with the same CVS filename - no code changes. ftp://ftp.qbang.org/pub/rxtx/rxtx-2.0-CVS-20050120-bins.tar.gz ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-CVS-20050120-bins.tar.gz -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Tue Apr 5 02:24:33 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 05 Apr 2005 09:24:33 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: References: <42515A83.4050907@emation.pt> Message-ID: <42524B41.3040300@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050405/5919abbb/attachment-0037.html From taj at www.linux.org.uk Tue Apr 5 03:00:29 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 10:00:29 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42524B41.3040300@emation.pt> References: <42515A83.4050907@emation.pt> <42524B41.3040300@emation.pt> Message-ID: On Tue, 5 Apr 2005, Ricardo Trindade wrote: > Will you anounce to the list when a new release is available ? > There will be several incremental releases announced here. Once those are done, we will release 2.1.7 and 2.0.7. -- Trent Jarvi taj at www.linux.org.uk From no_spam at somewhere.com Tue Apr 5 11:55:37 2005 From: no_spam at somewhere.com (no_spam@somewhere.com) Date: Tue, 5 Apr 2005 13:55:37 -0400 Subject: [Rxtx] Closing a port from an event listener results in a deadlock Message-ID: <20050405175537.GA21747@rcog.homelinux.net> On the message I sent on March 14, does anyone had the chance to try the modification? Or was it already fixed? (I haven't searched the archive extensively) Or maybe my message got catched by some spam filters? (it made it to the list archive though) Anyway, I would appreciate some feedback (through the list) Thanks From taj at www.linux.org.uk Tue Apr 5 14:42:28 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 21:42:28 +0100 (BST) Subject: [Rxtx] Closing a port from an event listener results in a deadlock In-Reply-To: <20050405175537.GA21747@rcog.homelinux.net> References: <20050405175537.GA21747@rcog.homelinux.net> Message-ID: On Tue, 5 Apr 2005 no_spam at somewhere.com wrote: > On the message I sent on March 14, does anyone had the chance to try the > modification? > > Or was it already fixed? (I haven't searched the archive extensively) > > Or maybe my message got catched by some spam filters? (it made it to the list > archive though) > > Anyway, I would appreciate some feedback (through the list) > The patch is here http://marc.theaimsgroup.com/?l=rxtx&m=111084488820288&w=2 I have applied this patch to a local copy but will not be doing formal testing for a couple weeks. I do not try to close ports from inside the eventListenter usually so I encourage any feedback also. If there are no problems reported, I expect this will go into rxtx 2.1-7. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Wed Apr 6 08:33:42 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Wed, 06 Apr 2005 15:33:42 +0100 Subject: [Rxtx] getting RXTX version Message-ID: <4253F346.50102@emation.pt> Hi, I want to make sure my deployments have the same version of RXTX jar and native lib. I know the version of the jar can be obtained in the Version class, but how can I obtain the native version ? I know RXTX prints to the console a warning if the version is different. Is there a way to programatically know is this is the case ? I would like to log that to our app's log thanks Ricardo From taj at www.linux.org.uk Wed Apr 6 15:10:20 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 6 Apr 2005 22:10:20 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4253F346.50102@emation.pt> References: <4253F346.50102@emation.pt> Message-ID: On Wed, 6 Apr 2005, Ricardo Trindade wrote: > Hi, > > I want to make sure my deployments have the same version of RXTX jar > and native lib. > > I know the version of the jar can be obtained in the Version class, > but how can I obtain the native version ? > > I know RXTX prints to the console a warning if the version is > different. Is there a way to programatically know is this is the case ? > > I would like to log that to our app's log > There isn't a suggested way of doing that right now. We could move things around and have a static String RXTXVersion.getNativeVersion() in future releases. Is this what you expected? This is not documented in commapi at all. I just tossed that in to catch conflicts while developing. It would be nice to have access in GUI applications though. It may be possible to access RXTXCommDriver.LibVersion right now. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Thu Apr 7 02:51:00 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 09:51:00 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> Message-ID: <4254F474.7020905@emation.pt> >There isn't a suggested way of doing that right now. We could move things >around and have a static String RXTXVersion.getNativeVersion() in future >releases. Is this what you expected? > > Yes, that would be perfect. >This is not documented in commapi at all. I just tossed that in to catch >conflicts while developing. It would be nice to have access in GUI >applications though. > >It may be possible to access RXTXCommDriver.LibVersion right now. > > > I tried, and I don't think it's possible. From taj at www.linux.org.uk Thu Apr 7 03:32:04 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 7 Apr 2005 10:32:04 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4254F474.7020905@emation.pt> References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: On Thu, 7 Apr 2005, Ricardo Trindade wrote: > > >There isn't a suggested way of doing that right now. We could move things > >around and have a static String RXTXVersion.getNativeVersion() in future > >releases. Is this what you expected? > > > > > > Yes, that would be perfect. > The attached should do what you want. You will still need to catch an exception for older versions... -- Trent Jarvi taj at www.linux.org.uk -------------- next part -------------- ? public_version.patch Index: RXTXCommDriver.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXCommDriver.java,v retrieving revision 1.16.2.51 diff -u -r1.16.2.51 RXTXCommDriver.java --- RXTXCommDriver.java 12 Oct 2004 09:13:30 -0000 1.16.2.51 +++ RXTXCommDriver.java 7 Apr 2005 09:29:04 -0000 @@ -54,7 +54,7 @@ the Library. */ String JarVersion = RXTXVersion.getVersion(); - String LibVersion = nativeGetVersion(); + String LibVersion = RXTXVersion.nativeGetVersion(); if ( devel ) { System.out.println("Devel Library"); @@ -76,7 +76,6 @@ /** Get the Serial port prefixes for the running OS */ private String deviceDirectory; private String osName; - private static native String nativeGetVersion(); private native boolean registerKnownPorts(int PortType); private native boolean isPortPrefixValid(String dev); private native boolean testRead(String dev, int type); Index: RXTXVersion.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXVersion.java,v retrieving revision 1.2.2.31 diff -u -r1.2.2.31 RXTXVersion.java --- RXTXVersion.java 16 Oct 2004 16:20:35 -0000 1.2.2.31 +++ RXTXVersion.java 7 Apr 2005 09:29:04 -0000 @@ -36,6 +36,7 @@ private static String Version; static { + System.loadLibrary( "rxtxSerial" ); Version = "RXTX-2.1-7pre20"; } /** @@ -47,4 +48,5 @@ { return(Version); } + public static native String nativeGetVersion(); } Index: SerialImp.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v retrieving revision 1.46.2.181 diff -u -r1.46.2.181 SerialImp.c --- SerialImp.c 17 Oct 2004 09:48:56 -0000 1.46.2.181 +++ SerialImp.c 7 Apr 2005 09:29:07 -0000 @@ -116,6 +116,7 @@ * It will eventually be removed. * */ #define RXTXPort(foo) Java_gnu_io_RXTXPort_ ## foo +#define RXTXVersion(foo) Java_gnu_io_RXTXVersion_ ## foo #define RXTXCommDriver(foo) Java_gnu_io_RXTXCommDriver_ ## foo #if defined(__sun__) || defined(__hpux__) @@ -4001,7 +4002,7 @@ } /*---------------------------------------------------------- -RXTXCommDriver.nativeGetVersion +RXTXVersion.nativeGetVersion accept: none perform: return the current version @@ -4010,9 +4011,10 @@ comments: This is used to avoid mixing versions of the .jar and native library. First introduced in rxtx-1.5-9 + Moved from RXTXCommDriver to RXTXVersion in rxtx-2.1-7 ----------------------------------------------------------*/ -JNIEXPORT jstring JNICALL RXTXCommDriver(nativeGetVersion) (JNIEnv *env, +JNIEXPORT jstring JNICALL RXTXVersion(nativeGetVersion) (JNIEnv *env, jclass jclazz ) { return (*env)->NewStringUTF( env, "RXTX-2.1-7pre20" ); From ricardo.trindade at emation.pt Thu Apr 7 03:45:58 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 10:45:58 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: <42550156.2040908@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050407/05212451/attachment-0037.html From thomas.shulok at lmco.com Thu Apr 7 17:43:11 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Thu, 07 Apr 2005 19:43:11 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi There, I'm attempting to talk RS232 between an embedded Linux box and a Windows box. Everything connects up fine, and I can send and receive a simple sequence of bytes with no problems. However, if around 5 seconds goes by without me sending something, I get the following when I attempt to send. java.io.IOException: Input/output error in writeArray Stack trace: java/lang/Throwable.()V java/lang/Throwable.(Ljava/lang/String;)V java/io/IOException.(Ljava/lang/String;)V gnu/io/RXTXPort.writeArray([BIIZ)V gnu/io/RXTXPort$SerialOutputStream.write([B)V SerialTest.main([Ljava/lang/String;)V If there interval is shorter (say 2 seconds between sends), I have no problems. On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and librxtxSerial-2.0.7pre2.so. Any ideas? Thanks, Thom -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5b23dcf/attachment-0037.html From taj at www.linux.org.uk Thu Apr 7 19:22:36 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:22:36 +0100 (BST) Subject: [Rxtx] Input/output error in writeArray In-Reply-To: References: Message-ID: On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a Windows > box. Everything connects up fine, and I can send and receive a simple > sequence of bytes with no problems. However, if around 5 seconds goes > by without me sending something, I get the following when I attempt to > send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Apr 7 19:24:59 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:24:59 +0100 (BST) Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) Message-ID: hmm. This would not work from applets would it? -- Trent Jarvi taj at www.linux.org.uk ---------- Forwarded message ---------- Date: Thu, 07 Apr 2005 16:05:53 -0400 From: Chris Gaffney To: taj at www.linux.org.uk Subject: RXTX Libraries on Classpath fix Hi, I submitted a patch for RXTX a few weeks ago to allow for loading the native libraries from the classpath. Since sending it to you I found it wasn't working on windows. I've fixed the problem and created a new patch that should replace the older one. The actual change is a one line from a String.equals() to a String.startsWith(). Thanks for a great piece of software, -Chris Gaffney Grand Valley State University -------------- next part -------------- A non-text attachment was scrubbed... Name: libraries_on_classpath_fixed.patch Type: text/x-patch Size: 5617 bytes Desc: Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5d423b8/libraries_on_classpath_fixed-0037.bin From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From thomas.shulok at lmco.com Fri Apr 8 10:38:55 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Fri, 08 Apr 2005 12:38:55 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi Trent, Thanks for the prompt response. Before diving deeper, I was wondering if there is a timeout parameter somewhere in the stack that I have not set properly. Given the nature of the failure (only fails if the line has been idle for a few seconds), it feels like some kind of timeout issue... Thanks again, Thom -----Original Message----- From: rxtx-bounces at mail.linuxgrrls.org [mailto:rxtx-bounces at mail.linuxgrrls.org] On Behalf Of Trent Jarvi Sent: Thursday, April 07, 2005 6:23 PM To: Java RXTX discussion Subject: Re: [Rxtx] Input/output error in writeArray On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a > Windows box. Everything connects up fine, and I can send and receive > a simple sequence of bytes with no problems. However, if around 5 > seconds goes by without me sending something, I get the following when > I attempt to send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at mail.linuxgrrls.org http://mail.linuxgrrls.org/mailman/listinfo/rxtx From ricardo.trindade at emation.pt Mon Apr 4 09:17:23 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Mon, 04 Apr 2005 16:17:23 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot Message-ID: <42515A83.4050907@emation.pt> Hi, I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most recent stable snapshot), and get the following exception : It looks like rxtx has been compiled with jdk 1.5. If this was indeed the case, I think there is a compilation flag that generates code that runs on older jdks. java.lang.UnsupportedClassVersionError: gnu/io/UnsupportedCommOperationException (Unsupported major.minor version 49.0) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at java.net.URLClassLoader.defineClass(URLClassLoader.java:251) at java.net.URLClassLoader.access$100(URLClassLoader.java:55) at java.net.URLClassLoader$1.run(URLClassLoader.java:194) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:187) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:141) I'm trying to run it with 1.4. thanks Ricardo From taj at www.linux.org.uk Tue Apr 5 00:48:12 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 07:48:12 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42515A83.4050907@emation.pt> References: <42515A83.4050907@emation.pt> Message-ID: On Mon, 4 Apr 2005, Ricardo Trindade wrote: > Hi, > > I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most > recent stable snapshot), and get the following exception : > > It looks like rxtx has been compiled with jdk 1.5. If this was > indeed the case, I think there is a compilation flag that generates code > that runs on older jdks. > > java.lang.UnsupportedClassVersionError: > gnu/io/UnsupportedCommOperationException (Unsupported major.minor > version 49.0) [snip] Thanks Ricardo I recompiled the jar with javac -source 1.3 -target 1.3. That should cover most of the JRE's in use today. I also compiled the rxtx 2.0 x86_64 native library which appeared to be missing. I tried looking for flags to pass gcc 4.0 to make the native libraries more backwards compatible but only found options for C++ which is not used in rxtx. I've got a list of other bugs that I'll be going through in the next few weeks but for now I just left them with the same CVS filename - no code changes. ftp://ftp.qbang.org/pub/rxtx/rxtx-2.0-CVS-20050120-bins.tar.gz ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-CVS-20050120-bins.tar.gz -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Tue Apr 5 02:24:33 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 05 Apr 2005 09:24:33 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: References: <42515A83.4050907@emation.pt> Message-ID: <42524B41.3040300@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050405/5919abbb/attachment-0038.html From taj at www.linux.org.uk Tue Apr 5 03:00:29 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 10:00:29 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42524B41.3040300@emation.pt> References: <42515A83.4050907@emation.pt> <42524B41.3040300@emation.pt> Message-ID: On Tue, 5 Apr 2005, Ricardo Trindade wrote: > Will you anounce to the list when a new release is available ? > There will be several incremental releases announced here. Once those are done, we will release 2.1.7 and 2.0.7. -- Trent Jarvi taj at www.linux.org.uk From no_spam at somewhere.com Tue Apr 5 11:55:37 2005 From: no_spam at somewhere.com (no_spam@somewhere.com) Date: Tue, 5 Apr 2005 13:55:37 -0400 Subject: [Rxtx] Closing a port from an event listener results in a deadlock Message-ID: <20050405175537.GA21747@rcog.homelinux.net> On the message I sent on March 14, does anyone had the chance to try the modification? Or was it already fixed? (I haven't searched the archive extensively) Or maybe my message got catched by some spam filters? (it made it to the list archive though) Anyway, I would appreciate some feedback (through the list) Thanks From taj at www.linux.org.uk Tue Apr 5 14:42:28 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 21:42:28 +0100 (BST) Subject: [Rxtx] Closing a port from an event listener results in a deadlock In-Reply-To: <20050405175537.GA21747@rcog.homelinux.net> References: <20050405175537.GA21747@rcog.homelinux.net> Message-ID: On Tue, 5 Apr 2005 no_spam at somewhere.com wrote: > On the message I sent on March 14, does anyone had the chance to try the > modification? > > Or was it already fixed? (I haven't searched the archive extensively) > > Or maybe my message got catched by some spam filters? (it made it to the list > archive though) > > Anyway, I would appreciate some feedback (through the list) > The patch is here http://marc.theaimsgroup.com/?l=rxtx&m=111084488820288&w=2 I have applied this patch to a local copy but will not be doing formal testing for a couple weeks. I do not try to close ports from inside the eventListenter usually so I encourage any feedback also. If there are no problems reported, I expect this will go into rxtx 2.1-7. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Wed Apr 6 08:33:42 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Wed, 06 Apr 2005 15:33:42 +0100 Subject: [Rxtx] getting RXTX version Message-ID: <4253F346.50102@emation.pt> Hi, I want to make sure my deployments have the same version of RXTX jar and native lib. I know the version of the jar can be obtained in the Version class, but how can I obtain the native version ? I know RXTX prints to the console a warning if the version is different. Is there a way to programatically know is this is the case ? I would like to log that to our app's log thanks Ricardo From taj at www.linux.org.uk Wed Apr 6 15:10:20 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 6 Apr 2005 22:10:20 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4253F346.50102@emation.pt> References: <4253F346.50102@emation.pt> Message-ID: On Wed, 6 Apr 2005, Ricardo Trindade wrote: > Hi, > > I want to make sure my deployments have the same version of RXTX jar > and native lib. > > I know the version of the jar can be obtained in the Version class, > but how can I obtain the native version ? > > I know RXTX prints to the console a warning if the version is > different. Is there a way to programatically know is this is the case ? > > I would like to log that to our app's log > There isn't a suggested way of doing that right now. We could move things around and have a static String RXTXVersion.getNativeVersion() in future releases. Is this what you expected? This is not documented in commapi at all. I just tossed that in to catch conflicts while developing. It would be nice to have access in GUI applications though. It may be possible to access RXTXCommDriver.LibVersion right now. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Thu Apr 7 02:51:00 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 09:51:00 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> Message-ID: <4254F474.7020905@emation.pt> >There isn't a suggested way of doing that right now. We could move things >around and have a static String RXTXVersion.getNativeVersion() in future >releases. Is this what you expected? > > Yes, that would be perfect. >This is not documented in commapi at all. I just tossed that in to catch >conflicts while developing. It would be nice to have access in GUI >applications though. > >It may be possible to access RXTXCommDriver.LibVersion right now. > > > I tried, and I don't think it's possible. From taj at www.linux.org.uk Thu Apr 7 03:32:04 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 7 Apr 2005 10:32:04 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4254F474.7020905@emation.pt> References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: On Thu, 7 Apr 2005, Ricardo Trindade wrote: > > >There isn't a suggested way of doing that right now. We could move things > >around and have a static String RXTXVersion.getNativeVersion() in future > >releases. Is this what you expected? > > > > > > Yes, that would be perfect. > The attached should do what you want. You will still need to catch an exception for older versions... -- Trent Jarvi taj at www.linux.org.uk -------------- next part -------------- ? public_version.patch Index: RXTXCommDriver.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXCommDriver.java,v retrieving revision 1.16.2.51 diff -u -r1.16.2.51 RXTXCommDriver.java --- RXTXCommDriver.java 12 Oct 2004 09:13:30 -0000 1.16.2.51 +++ RXTXCommDriver.java 7 Apr 2005 09:29:04 -0000 @@ -54,7 +54,7 @@ the Library. */ String JarVersion = RXTXVersion.getVersion(); - String LibVersion = nativeGetVersion(); + String LibVersion = RXTXVersion.nativeGetVersion(); if ( devel ) { System.out.println("Devel Library"); @@ -76,7 +76,6 @@ /** Get the Serial port prefixes for the running OS */ private String deviceDirectory; private String osName; - private static native String nativeGetVersion(); private native boolean registerKnownPorts(int PortType); private native boolean isPortPrefixValid(String dev); private native boolean testRead(String dev, int type); Index: RXTXVersion.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXVersion.java,v retrieving revision 1.2.2.31 diff -u -r1.2.2.31 RXTXVersion.java --- RXTXVersion.java 16 Oct 2004 16:20:35 -0000 1.2.2.31 +++ RXTXVersion.java 7 Apr 2005 09:29:04 -0000 @@ -36,6 +36,7 @@ private static String Version; static { + System.loadLibrary( "rxtxSerial" ); Version = "RXTX-2.1-7pre20"; } /** @@ -47,4 +48,5 @@ { return(Version); } + public static native String nativeGetVersion(); } Index: SerialImp.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v retrieving revision 1.46.2.181 diff -u -r1.46.2.181 SerialImp.c --- SerialImp.c 17 Oct 2004 09:48:56 -0000 1.46.2.181 +++ SerialImp.c 7 Apr 2005 09:29:07 -0000 @@ -116,6 +116,7 @@ * It will eventually be removed. * */ #define RXTXPort(foo) Java_gnu_io_RXTXPort_ ## foo +#define RXTXVersion(foo) Java_gnu_io_RXTXVersion_ ## foo #define RXTXCommDriver(foo) Java_gnu_io_RXTXCommDriver_ ## foo #if defined(__sun__) || defined(__hpux__) @@ -4001,7 +4002,7 @@ } /*---------------------------------------------------------- -RXTXCommDriver.nativeGetVersion +RXTXVersion.nativeGetVersion accept: none perform: return the current version @@ -4010,9 +4011,10 @@ comments: This is used to avoid mixing versions of the .jar and native library. First introduced in rxtx-1.5-9 + Moved from RXTXCommDriver to RXTXVersion in rxtx-2.1-7 ----------------------------------------------------------*/ -JNIEXPORT jstring JNICALL RXTXCommDriver(nativeGetVersion) (JNIEnv *env, +JNIEXPORT jstring JNICALL RXTXVersion(nativeGetVersion) (JNIEnv *env, jclass jclazz ) { return (*env)->NewStringUTF( env, "RXTX-2.1-7pre20" ); From ricardo.trindade at emation.pt Thu Apr 7 03:45:58 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 10:45:58 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: <42550156.2040908@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050407/05212451/attachment-0038.html From thomas.shulok at lmco.com Thu Apr 7 17:43:11 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Thu, 07 Apr 2005 19:43:11 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi There, I'm attempting to talk RS232 between an embedded Linux box and a Windows box. Everything connects up fine, and I can send and receive a simple sequence of bytes with no problems. However, if around 5 seconds goes by without me sending something, I get the following when I attempt to send. java.io.IOException: Input/output error in writeArray Stack trace: java/lang/Throwable.()V java/lang/Throwable.(Ljava/lang/String;)V java/io/IOException.(Ljava/lang/String;)V gnu/io/RXTXPort.writeArray([BIIZ)V gnu/io/RXTXPort$SerialOutputStream.write([B)V SerialTest.main([Ljava/lang/String;)V If there interval is shorter (say 2 seconds between sends), I have no problems. On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and librxtxSerial-2.0.7pre2.so. Any ideas? Thanks, Thom -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5b23dcf/attachment-0038.html From taj at www.linux.org.uk Thu Apr 7 19:22:36 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:22:36 +0100 (BST) Subject: [Rxtx] Input/output error in writeArray In-Reply-To: References: Message-ID: On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a Windows > box. Everything connects up fine, and I can send and receive a simple > sequence of bytes with no problems. However, if around 5 seconds goes > by without me sending something, I get the following when I attempt to > send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Apr 7 19:24:59 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:24:59 +0100 (BST) Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) Message-ID: hmm. This would not work from applets would it? -- Trent Jarvi taj at www.linux.org.uk ---------- Forwarded message ---------- Date: Thu, 07 Apr 2005 16:05:53 -0400 From: Chris Gaffney To: taj at www.linux.org.uk Subject: RXTX Libraries on Classpath fix Hi, I submitted a patch for RXTX a few weeks ago to allow for loading the native libraries from the classpath. Since sending it to you I found it wasn't working on windows. I've fixed the problem and created a new patch that should replace the older one. The actual change is a one line from a String.equals() to a String.startsWith(). Thanks for a great piece of software, -Chris Gaffney Grand Valley State University -------------- next part -------------- A non-text attachment was scrubbed... Name: libraries_on_classpath_fixed.patch Type: text/x-patch Size: 5617 bytes Desc: Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5d423b8/libraries_on_classpath_fixed-0038.bin From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From thomas.shulok at lmco.com Fri Apr 8 10:38:55 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Fri, 08 Apr 2005 12:38:55 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi Trent, Thanks for the prompt response. Before diving deeper, I was wondering if there is a timeout parameter somewhere in the stack that I have not set properly. Given the nature of the failure (only fails if the line has been idle for a few seconds), it feels like some kind of timeout issue... Thanks again, Thom -----Original Message----- From: rxtx-bounces at mail.linuxgrrls.org [mailto:rxtx-bounces at mail.linuxgrrls.org] On Behalf Of Trent Jarvi Sent: Thursday, April 07, 2005 6:23 PM To: Java RXTX discussion Subject: Re: [Rxtx] Input/output error in writeArray On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a > Windows box. Everything connects up fine, and I can send and receive > a simple sequence of bytes with no problems. However, if around 5 > seconds goes by without me sending something, I get the following when > I attempt to send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at mail.linuxgrrls.org http://mail.linuxgrrls.org/mailman/listinfo/rxtx From ricardo.trindade at emation.pt Mon Apr 4 09:17:23 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Mon, 04 Apr 2005 16:17:23 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot Message-ID: <42515A83.4050907@emation.pt> Hi, I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most recent stable snapshot), and get the following exception : It looks like rxtx has been compiled with jdk 1.5. If this was indeed the case, I think there is a compilation flag that generates code that runs on older jdks. java.lang.UnsupportedClassVersionError: gnu/io/UnsupportedCommOperationException (Unsupported major.minor version 49.0) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at java.net.URLClassLoader.defineClass(URLClassLoader.java:251) at java.net.URLClassLoader.access$100(URLClassLoader.java:55) at java.net.URLClassLoader$1.run(URLClassLoader.java:194) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:187) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:141) I'm trying to run it with 1.4. thanks Ricardo From taj at www.linux.org.uk Tue Apr 5 00:48:12 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 07:48:12 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42515A83.4050907@emation.pt> References: <42515A83.4050907@emation.pt> Message-ID: On Mon, 4 Apr 2005, Ricardo Trindade wrote: > Hi, > > I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most > recent stable snapshot), and get the following exception : > > It looks like rxtx has been compiled with jdk 1.5. If this was > indeed the case, I think there is a compilation flag that generates code > that runs on older jdks. > > java.lang.UnsupportedClassVersionError: > gnu/io/UnsupportedCommOperationException (Unsupported major.minor > version 49.0) [snip] Thanks Ricardo I recompiled the jar with javac -source 1.3 -target 1.3. That should cover most of the JRE's in use today. I also compiled the rxtx 2.0 x86_64 native library which appeared to be missing. I tried looking for flags to pass gcc 4.0 to make the native libraries more backwards compatible but only found options for C++ which is not used in rxtx. I've got a list of other bugs that I'll be going through in the next few weeks but for now I just left them with the same CVS filename - no code changes. ftp://ftp.qbang.org/pub/rxtx/rxtx-2.0-CVS-20050120-bins.tar.gz ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-CVS-20050120-bins.tar.gz -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Tue Apr 5 02:24:33 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 05 Apr 2005 09:24:33 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: References: <42515A83.4050907@emation.pt> Message-ID: <42524B41.3040300@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050405/5919abbb/attachment-0039.html From taj at www.linux.org.uk Tue Apr 5 03:00:29 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 10:00:29 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42524B41.3040300@emation.pt> References: <42515A83.4050907@emation.pt> <42524B41.3040300@emation.pt> Message-ID: On Tue, 5 Apr 2005, Ricardo Trindade wrote: > Will you anounce to the list when a new release is available ? > There will be several incremental releases announced here. Once those are done, we will release 2.1.7 and 2.0.7. -- Trent Jarvi taj at www.linux.org.uk From no_spam at somewhere.com Tue Apr 5 11:55:37 2005 From: no_spam at somewhere.com (no_spam@somewhere.com) Date: Tue, 5 Apr 2005 13:55:37 -0400 Subject: [Rxtx] Closing a port from an event listener results in a deadlock Message-ID: <20050405175537.GA21747@rcog.homelinux.net> On the message I sent on March 14, does anyone had the chance to try the modification? Or was it already fixed? (I haven't searched the archive extensively) Or maybe my message got catched by some spam filters? (it made it to the list archive though) Anyway, I would appreciate some feedback (through the list) Thanks From taj at www.linux.org.uk Tue Apr 5 14:42:28 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 21:42:28 +0100 (BST) Subject: [Rxtx] Closing a port from an event listener results in a deadlock In-Reply-To: <20050405175537.GA21747@rcog.homelinux.net> References: <20050405175537.GA21747@rcog.homelinux.net> Message-ID: On Tue, 5 Apr 2005 no_spam at somewhere.com wrote: > On the message I sent on March 14, does anyone had the chance to try the > modification? > > Or was it already fixed? (I haven't searched the archive extensively) > > Or maybe my message got catched by some spam filters? (it made it to the list > archive though) > > Anyway, I would appreciate some feedback (through the list) > The patch is here http://marc.theaimsgroup.com/?l=rxtx&m=111084488820288&w=2 I have applied this patch to a local copy but will not be doing formal testing for a couple weeks. I do not try to close ports from inside the eventListenter usually so I encourage any feedback also. If there are no problems reported, I expect this will go into rxtx 2.1-7. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Wed Apr 6 08:33:42 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Wed, 06 Apr 2005 15:33:42 +0100 Subject: [Rxtx] getting RXTX version Message-ID: <4253F346.50102@emation.pt> Hi, I want to make sure my deployments have the same version of RXTX jar and native lib. I know the version of the jar can be obtained in the Version class, but how can I obtain the native version ? I know RXTX prints to the console a warning if the version is different. Is there a way to programatically know is this is the case ? I would like to log that to our app's log thanks Ricardo From taj at www.linux.org.uk Wed Apr 6 15:10:20 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 6 Apr 2005 22:10:20 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4253F346.50102@emation.pt> References: <4253F346.50102@emation.pt> Message-ID: On Wed, 6 Apr 2005, Ricardo Trindade wrote: > Hi, > > I want to make sure my deployments have the same version of RXTX jar > and native lib. > > I know the version of the jar can be obtained in the Version class, > but how can I obtain the native version ? > > I know RXTX prints to the console a warning if the version is > different. Is there a way to programatically know is this is the case ? > > I would like to log that to our app's log > There isn't a suggested way of doing that right now. We could move things around and have a static String RXTXVersion.getNativeVersion() in future releases. Is this what you expected? This is not documented in commapi at all. I just tossed that in to catch conflicts while developing. It would be nice to have access in GUI applications though. It may be possible to access RXTXCommDriver.LibVersion right now. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Thu Apr 7 02:51:00 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 09:51:00 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> Message-ID: <4254F474.7020905@emation.pt> >There isn't a suggested way of doing that right now. We could move things >around and have a static String RXTXVersion.getNativeVersion() in future >releases. Is this what you expected? > > Yes, that would be perfect. >This is not documented in commapi at all. I just tossed that in to catch >conflicts while developing. It would be nice to have access in GUI >applications though. > >It may be possible to access RXTXCommDriver.LibVersion right now. > > > I tried, and I don't think it's possible. From taj at www.linux.org.uk Thu Apr 7 03:32:04 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 7 Apr 2005 10:32:04 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4254F474.7020905@emation.pt> References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: On Thu, 7 Apr 2005, Ricardo Trindade wrote: > > >There isn't a suggested way of doing that right now. We could move things > >around and have a static String RXTXVersion.getNativeVersion() in future > >releases. Is this what you expected? > > > > > > Yes, that would be perfect. > The attached should do what you want. You will still need to catch an exception for older versions... -- Trent Jarvi taj at www.linux.org.uk -------------- next part -------------- ? public_version.patch Index: RXTXCommDriver.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXCommDriver.java,v retrieving revision 1.16.2.51 diff -u -r1.16.2.51 RXTXCommDriver.java --- RXTXCommDriver.java 12 Oct 2004 09:13:30 -0000 1.16.2.51 +++ RXTXCommDriver.java 7 Apr 2005 09:29:04 -0000 @@ -54,7 +54,7 @@ the Library. */ String JarVersion = RXTXVersion.getVersion(); - String LibVersion = nativeGetVersion(); + String LibVersion = RXTXVersion.nativeGetVersion(); if ( devel ) { System.out.println("Devel Library"); @@ -76,7 +76,6 @@ /** Get the Serial port prefixes for the running OS */ private String deviceDirectory; private String osName; - private static native String nativeGetVersion(); private native boolean registerKnownPorts(int PortType); private native boolean isPortPrefixValid(String dev); private native boolean testRead(String dev, int type); Index: RXTXVersion.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXVersion.java,v retrieving revision 1.2.2.31 diff -u -r1.2.2.31 RXTXVersion.java --- RXTXVersion.java 16 Oct 2004 16:20:35 -0000 1.2.2.31 +++ RXTXVersion.java 7 Apr 2005 09:29:04 -0000 @@ -36,6 +36,7 @@ private static String Version; static { + System.loadLibrary( "rxtxSerial" ); Version = "RXTX-2.1-7pre20"; } /** @@ -47,4 +48,5 @@ { return(Version); } + public static native String nativeGetVersion(); } Index: SerialImp.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v retrieving revision 1.46.2.181 diff -u -r1.46.2.181 SerialImp.c --- SerialImp.c 17 Oct 2004 09:48:56 -0000 1.46.2.181 +++ SerialImp.c 7 Apr 2005 09:29:07 -0000 @@ -116,6 +116,7 @@ * It will eventually be removed. * */ #define RXTXPort(foo) Java_gnu_io_RXTXPort_ ## foo +#define RXTXVersion(foo) Java_gnu_io_RXTXVersion_ ## foo #define RXTXCommDriver(foo) Java_gnu_io_RXTXCommDriver_ ## foo #if defined(__sun__) || defined(__hpux__) @@ -4001,7 +4002,7 @@ } /*---------------------------------------------------------- -RXTXCommDriver.nativeGetVersion +RXTXVersion.nativeGetVersion accept: none perform: return the current version @@ -4010,9 +4011,10 @@ comments: This is used to avoid mixing versions of the .jar and native library. First introduced in rxtx-1.5-9 + Moved from RXTXCommDriver to RXTXVersion in rxtx-2.1-7 ----------------------------------------------------------*/ -JNIEXPORT jstring JNICALL RXTXCommDriver(nativeGetVersion) (JNIEnv *env, +JNIEXPORT jstring JNICALL RXTXVersion(nativeGetVersion) (JNIEnv *env, jclass jclazz ) { return (*env)->NewStringUTF( env, "RXTX-2.1-7pre20" ); From ricardo.trindade at emation.pt Thu Apr 7 03:45:58 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 10:45:58 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: <42550156.2040908@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050407/05212451/attachment-0039.html From thomas.shulok at lmco.com Thu Apr 7 17:43:11 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Thu, 07 Apr 2005 19:43:11 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi There, I'm attempting to talk RS232 between an embedded Linux box and a Windows box. Everything connects up fine, and I can send and receive a simple sequence of bytes with no problems. However, if around 5 seconds goes by without me sending something, I get the following when I attempt to send. java.io.IOException: Input/output error in writeArray Stack trace: java/lang/Throwable.()V java/lang/Throwable.(Ljava/lang/String;)V java/io/IOException.(Ljava/lang/String;)V gnu/io/RXTXPort.writeArray([BIIZ)V gnu/io/RXTXPort$SerialOutputStream.write([B)V SerialTest.main([Ljava/lang/String;)V If there interval is shorter (say 2 seconds between sends), I have no problems. On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and librxtxSerial-2.0.7pre2.so. Any ideas? Thanks, Thom -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5b23dcf/attachment-0039.html From taj at www.linux.org.uk Thu Apr 7 19:22:36 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:22:36 +0100 (BST) Subject: [Rxtx] Input/output error in writeArray In-Reply-To: References: Message-ID: On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a Windows > box. Everything connects up fine, and I can send and receive a simple > sequence of bytes with no problems. However, if around 5 seconds goes > by without me sending something, I get the following when I attempt to > send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Apr 7 19:24:59 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:24:59 +0100 (BST) Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) Message-ID: hmm. This would not work from applets would it? -- Trent Jarvi taj at www.linux.org.uk ---------- Forwarded message ---------- Date: Thu, 07 Apr 2005 16:05:53 -0400 From: Chris Gaffney To: taj at www.linux.org.uk Subject: RXTX Libraries on Classpath fix Hi, I submitted a patch for RXTX a few weeks ago to allow for loading the native libraries from the classpath. Since sending it to you I found it wasn't working on windows. I've fixed the problem and created a new patch that should replace the older one. The actual change is a one line from a String.equals() to a String.startsWith(). Thanks for a great piece of software, -Chris Gaffney Grand Valley State University -------------- next part -------------- A non-text attachment was scrubbed... Name: libraries_on_classpath_fixed.patch Type: text/x-patch Size: 5617 bytes Desc: Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5d423b8/libraries_on_classpath_fixed-0039.bin From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From thomas.shulok at lmco.com Fri Apr 8 10:38:55 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Fri, 08 Apr 2005 12:38:55 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi Trent, Thanks for the prompt response. Before diving deeper, I was wondering if there is a timeout parameter somewhere in the stack that I have not set properly. Given the nature of the failure (only fails if the line has been idle for a few seconds), it feels like some kind of timeout issue... Thanks again, Thom -----Original Message----- From: rxtx-bounces at mail.linuxgrrls.org [mailto:rxtx-bounces at mail.linuxgrrls.org] On Behalf Of Trent Jarvi Sent: Thursday, April 07, 2005 6:23 PM To: Java RXTX discussion Subject: Re: [Rxtx] Input/output error in writeArray On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a > Windows box. Everything connects up fine, and I can send and receive > a simple sequence of bytes with no problems. However, if around 5 > seconds goes by without me sending something, I get the following when > I attempt to send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at mail.linuxgrrls.org http://mail.linuxgrrls.org/mailman/listinfo/rxtx From ricardo.trindade at emation.pt Mon Apr 4 09:17:23 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Mon, 04 Apr 2005 16:17:23 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot Message-ID: <42515A83.4050907@emation.pt> Hi, I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most recent stable snapshot), and get the following exception : It looks like rxtx has been compiled with jdk 1.5. If this was indeed the case, I think there is a compilation flag that generates code that runs on older jdks. java.lang.UnsupportedClassVersionError: gnu/io/UnsupportedCommOperationException (Unsupported major.minor version 49.0) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at java.net.URLClassLoader.defineClass(URLClassLoader.java:251) at java.net.URLClassLoader.access$100(URLClassLoader.java:55) at java.net.URLClassLoader$1.run(URLClassLoader.java:194) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:187) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:141) I'm trying to run it with 1.4. thanks Ricardo From taj at www.linux.org.uk Tue Apr 5 00:48:12 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 07:48:12 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42515A83.4050907@emation.pt> References: <42515A83.4050907@emation.pt> Message-ID: On Mon, 4 Apr 2005, Ricardo Trindade wrote: > Hi, > > I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most > recent stable snapshot), and get the following exception : > > It looks like rxtx has been compiled with jdk 1.5. If this was > indeed the case, I think there is a compilation flag that generates code > that runs on older jdks. > > java.lang.UnsupportedClassVersionError: > gnu/io/UnsupportedCommOperationException (Unsupported major.minor > version 49.0) [snip] Thanks Ricardo I recompiled the jar with javac -source 1.3 -target 1.3. That should cover most of the JRE's in use today. I also compiled the rxtx 2.0 x86_64 native library which appeared to be missing. I tried looking for flags to pass gcc 4.0 to make the native libraries more backwards compatible but only found options for C++ which is not used in rxtx. I've got a list of other bugs that I'll be going through in the next few weeks but for now I just left them with the same CVS filename - no code changes. ftp://ftp.qbang.org/pub/rxtx/rxtx-2.0-CVS-20050120-bins.tar.gz ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-CVS-20050120-bins.tar.gz -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Tue Apr 5 02:24:33 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 05 Apr 2005 09:24:33 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: References: <42515A83.4050907@emation.pt> Message-ID: <42524B41.3040300@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050405/5919abbb/attachment-0040.html From taj at www.linux.org.uk Tue Apr 5 03:00:29 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 10:00:29 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42524B41.3040300@emation.pt> References: <42515A83.4050907@emation.pt> <42524B41.3040300@emation.pt> Message-ID: On Tue, 5 Apr 2005, Ricardo Trindade wrote: > Will you anounce to the list when a new release is available ? > There will be several incremental releases announced here. Once those are done, we will release 2.1.7 and 2.0.7. -- Trent Jarvi taj at www.linux.org.uk From no_spam at somewhere.com Tue Apr 5 11:55:37 2005 From: no_spam at somewhere.com (no_spam@somewhere.com) Date: Tue, 5 Apr 2005 13:55:37 -0400 Subject: [Rxtx] Closing a port from an event listener results in a deadlock Message-ID: <20050405175537.GA21747@rcog.homelinux.net> On the message I sent on March 14, does anyone had the chance to try the modification? Or was it already fixed? (I haven't searched the archive extensively) Or maybe my message got catched by some spam filters? (it made it to the list archive though) Anyway, I would appreciate some feedback (through the list) Thanks From taj at www.linux.org.uk Tue Apr 5 14:42:28 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 21:42:28 +0100 (BST) Subject: [Rxtx] Closing a port from an event listener results in a deadlock In-Reply-To: <20050405175537.GA21747@rcog.homelinux.net> References: <20050405175537.GA21747@rcog.homelinux.net> Message-ID: On Tue, 5 Apr 2005 no_spam at somewhere.com wrote: > On the message I sent on March 14, does anyone had the chance to try the > modification? > > Or was it already fixed? (I haven't searched the archive extensively) > > Or maybe my message got catched by some spam filters? (it made it to the list > archive though) > > Anyway, I would appreciate some feedback (through the list) > The patch is here http://marc.theaimsgroup.com/?l=rxtx&m=111084488820288&w=2 I have applied this patch to a local copy but will not be doing formal testing for a couple weeks. I do not try to close ports from inside the eventListenter usually so I encourage any feedback also. If there are no problems reported, I expect this will go into rxtx 2.1-7. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Wed Apr 6 08:33:42 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Wed, 06 Apr 2005 15:33:42 +0100 Subject: [Rxtx] getting RXTX version Message-ID: <4253F346.50102@emation.pt> Hi, I want to make sure my deployments have the same version of RXTX jar and native lib. I know the version of the jar can be obtained in the Version class, but how can I obtain the native version ? I know RXTX prints to the console a warning if the version is different. Is there a way to programatically know is this is the case ? I would like to log that to our app's log thanks Ricardo From taj at www.linux.org.uk Wed Apr 6 15:10:20 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 6 Apr 2005 22:10:20 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4253F346.50102@emation.pt> References: <4253F346.50102@emation.pt> Message-ID: On Wed, 6 Apr 2005, Ricardo Trindade wrote: > Hi, > > I want to make sure my deployments have the same version of RXTX jar > and native lib. > > I know the version of the jar can be obtained in the Version class, > but how can I obtain the native version ? > > I know RXTX prints to the console a warning if the version is > different. Is there a way to programatically know is this is the case ? > > I would like to log that to our app's log > There isn't a suggested way of doing that right now. We could move things around and have a static String RXTXVersion.getNativeVersion() in future releases. Is this what you expected? This is not documented in commapi at all. I just tossed that in to catch conflicts while developing. It would be nice to have access in GUI applications though. It may be possible to access RXTXCommDriver.LibVersion right now. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Thu Apr 7 02:51:00 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 09:51:00 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> Message-ID: <4254F474.7020905@emation.pt> >There isn't a suggested way of doing that right now. We could move things >around and have a static String RXTXVersion.getNativeVersion() in future >releases. Is this what you expected? > > Yes, that would be perfect. >This is not documented in commapi at all. I just tossed that in to catch >conflicts while developing. It would be nice to have access in GUI >applications though. > >It may be possible to access RXTXCommDriver.LibVersion right now. > > > I tried, and I don't think it's possible. From taj at www.linux.org.uk Thu Apr 7 03:32:04 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 7 Apr 2005 10:32:04 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4254F474.7020905@emation.pt> References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: On Thu, 7 Apr 2005, Ricardo Trindade wrote: > > >There isn't a suggested way of doing that right now. We could move things > >around and have a static String RXTXVersion.getNativeVersion() in future > >releases. Is this what you expected? > > > > > > Yes, that would be perfect. > The attached should do what you want. You will still need to catch an exception for older versions... -- Trent Jarvi taj at www.linux.org.uk -------------- next part -------------- ? public_version.patch Index: RXTXCommDriver.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXCommDriver.java,v retrieving revision 1.16.2.51 diff -u -r1.16.2.51 RXTXCommDriver.java --- RXTXCommDriver.java 12 Oct 2004 09:13:30 -0000 1.16.2.51 +++ RXTXCommDriver.java 7 Apr 2005 09:29:04 -0000 @@ -54,7 +54,7 @@ the Library. */ String JarVersion = RXTXVersion.getVersion(); - String LibVersion = nativeGetVersion(); + String LibVersion = RXTXVersion.nativeGetVersion(); if ( devel ) { System.out.println("Devel Library"); @@ -76,7 +76,6 @@ /** Get the Serial port prefixes for the running OS */ private String deviceDirectory; private String osName; - private static native String nativeGetVersion(); private native boolean registerKnownPorts(int PortType); private native boolean isPortPrefixValid(String dev); private native boolean testRead(String dev, int type); Index: RXTXVersion.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXVersion.java,v retrieving revision 1.2.2.31 diff -u -r1.2.2.31 RXTXVersion.java --- RXTXVersion.java 16 Oct 2004 16:20:35 -0000 1.2.2.31 +++ RXTXVersion.java 7 Apr 2005 09:29:04 -0000 @@ -36,6 +36,7 @@ private static String Version; static { + System.loadLibrary( "rxtxSerial" ); Version = "RXTX-2.1-7pre20"; } /** @@ -47,4 +48,5 @@ { return(Version); } + public static native String nativeGetVersion(); } Index: SerialImp.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v retrieving revision 1.46.2.181 diff -u -r1.46.2.181 SerialImp.c --- SerialImp.c 17 Oct 2004 09:48:56 -0000 1.46.2.181 +++ SerialImp.c 7 Apr 2005 09:29:07 -0000 @@ -116,6 +116,7 @@ * It will eventually be removed. * */ #define RXTXPort(foo) Java_gnu_io_RXTXPort_ ## foo +#define RXTXVersion(foo) Java_gnu_io_RXTXVersion_ ## foo #define RXTXCommDriver(foo) Java_gnu_io_RXTXCommDriver_ ## foo #if defined(__sun__) || defined(__hpux__) @@ -4001,7 +4002,7 @@ } /*---------------------------------------------------------- -RXTXCommDriver.nativeGetVersion +RXTXVersion.nativeGetVersion accept: none perform: return the current version @@ -4010,9 +4011,10 @@ comments: This is used to avoid mixing versions of the .jar and native library. First introduced in rxtx-1.5-9 + Moved from RXTXCommDriver to RXTXVersion in rxtx-2.1-7 ----------------------------------------------------------*/ -JNIEXPORT jstring JNICALL RXTXCommDriver(nativeGetVersion) (JNIEnv *env, +JNIEXPORT jstring JNICALL RXTXVersion(nativeGetVersion) (JNIEnv *env, jclass jclazz ) { return (*env)->NewStringUTF( env, "RXTX-2.1-7pre20" ); From ricardo.trindade at emation.pt Thu Apr 7 03:45:58 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 10:45:58 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: <42550156.2040908@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050407/05212451/attachment-0040.html From thomas.shulok at lmco.com Thu Apr 7 17:43:11 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Thu, 07 Apr 2005 19:43:11 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi There, I'm attempting to talk RS232 between an embedded Linux box and a Windows box. Everything connects up fine, and I can send and receive a simple sequence of bytes with no problems. However, if around 5 seconds goes by without me sending something, I get the following when I attempt to send. java.io.IOException: Input/output error in writeArray Stack trace: java/lang/Throwable.()V java/lang/Throwable.(Ljava/lang/String;)V java/io/IOException.(Ljava/lang/String;)V gnu/io/RXTXPort.writeArray([BIIZ)V gnu/io/RXTXPort$SerialOutputStream.write([B)V SerialTest.main([Ljava/lang/String;)V If there interval is shorter (say 2 seconds between sends), I have no problems. On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and librxtxSerial-2.0.7pre2.so. Any ideas? Thanks, Thom -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5b23dcf/attachment-0040.html From taj at www.linux.org.uk Thu Apr 7 19:22:36 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:22:36 +0100 (BST) Subject: [Rxtx] Input/output error in writeArray In-Reply-To: References: Message-ID: On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a Windows > box. Everything connects up fine, and I can send and receive a simple > sequence of bytes with no problems. However, if around 5 seconds goes > by without me sending something, I get the following when I attempt to > send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Apr 7 19:24:59 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:24:59 +0100 (BST) Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) Message-ID: hmm. This would not work from applets would it? -- Trent Jarvi taj at www.linux.org.uk ---------- Forwarded message ---------- Date: Thu, 07 Apr 2005 16:05:53 -0400 From: Chris Gaffney To: taj at www.linux.org.uk Subject: RXTX Libraries on Classpath fix Hi, I submitted a patch for RXTX a few weeks ago to allow for loading the native libraries from the classpath. Since sending it to you I found it wasn't working on windows. I've fixed the problem and created a new patch that should replace the older one. The actual change is a one line from a String.equals() to a String.startsWith(). Thanks for a great piece of software, -Chris Gaffney Grand Valley State University -------------- next part -------------- A non-text attachment was scrubbed... Name: libraries_on_classpath_fixed.patch Type: text/x-patch Size: 5617 bytes Desc: Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5d423b8/libraries_on_classpath_fixed-0040.bin From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From thomas.shulok at lmco.com Fri Apr 8 10:38:55 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Fri, 08 Apr 2005 12:38:55 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi Trent, Thanks for the prompt response. Before diving deeper, I was wondering if there is a timeout parameter somewhere in the stack that I have not set properly. Given the nature of the failure (only fails if the line has been idle for a few seconds), it feels like some kind of timeout issue... Thanks again, Thom -----Original Message----- From: rxtx-bounces at mail.linuxgrrls.org [mailto:rxtx-bounces at mail.linuxgrrls.org] On Behalf Of Trent Jarvi Sent: Thursday, April 07, 2005 6:23 PM To: Java RXTX discussion Subject: Re: [Rxtx] Input/output error in writeArray On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a > Windows box. Everything connects up fine, and I can send and receive > a simple sequence of bytes with no problems. However, if around 5 > seconds goes by without me sending something, I get the following when > I attempt to send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at mail.linuxgrrls.org http://mail.linuxgrrls.org/mailman/listinfo/rxtx From ricardo.trindade at emation.pt Mon Apr 4 09:17:23 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Mon, 04 Apr 2005 16:17:23 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot Message-ID: <42515A83.4050907@emation.pt> Hi, I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most recent stable snapshot), and get the following exception : It looks like rxtx has been compiled with jdk 1.5. If this was indeed the case, I think there is a compilation flag that generates code that runs on older jdks. java.lang.UnsupportedClassVersionError: gnu/io/UnsupportedCommOperationException (Unsupported major.minor version 49.0) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at java.net.URLClassLoader.defineClass(URLClassLoader.java:251) at java.net.URLClassLoader.access$100(URLClassLoader.java:55) at java.net.URLClassLoader$1.run(URLClassLoader.java:194) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:187) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:141) I'm trying to run it with 1.4. thanks Ricardo From taj at www.linux.org.uk Tue Apr 5 00:48:12 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 07:48:12 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42515A83.4050907@emation.pt> References: <42515A83.4050907@emation.pt> Message-ID: On Mon, 4 Apr 2005, Ricardo Trindade wrote: > Hi, > > I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most > recent stable snapshot), and get the following exception : > > It looks like rxtx has been compiled with jdk 1.5. If this was > indeed the case, I think there is a compilation flag that generates code > that runs on older jdks. > > java.lang.UnsupportedClassVersionError: > gnu/io/UnsupportedCommOperationException (Unsupported major.minor > version 49.0) [snip] Thanks Ricardo I recompiled the jar with javac -source 1.3 -target 1.3. That should cover most of the JRE's in use today. I also compiled the rxtx 2.0 x86_64 native library which appeared to be missing. I tried looking for flags to pass gcc 4.0 to make the native libraries more backwards compatible but only found options for C++ which is not used in rxtx. I've got a list of other bugs that I'll be going through in the next few weeks but for now I just left them with the same CVS filename - no code changes. ftp://ftp.qbang.org/pub/rxtx/rxtx-2.0-CVS-20050120-bins.tar.gz ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-CVS-20050120-bins.tar.gz -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Tue Apr 5 02:24:33 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 05 Apr 2005 09:24:33 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: References: <42515A83.4050907@emation.pt> Message-ID: <42524B41.3040300@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050405/5919abbb/attachment-0041.html From taj at www.linux.org.uk Tue Apr 5 03:00:29 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 10:00:29 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42524B41.3040300@emation.pt> References: <42515A83.4050907@emation.pt> <42524B41.3040300@emation.pt> Message-ID: On Tue, 5 Apr 2005, Ricardo Trindade wrote: > Will you anounce to the list when a new release is available ? > There will be several incremental releases announced here. Once those are done, we will release 2.1.7 and 2.0.7. -- Trent Jarvi taj at www.linux.org.uk From no_spam at somewhere.com Tue Apr 5 11:55:37 2005 From: no_spam at somewhere.com (no_spam@somewhere.com) Date: Tue, 5 Apr 2005 13:55:37 -0400 Subject: [Rxtx] Closing a port from an event listener results in a deadlock Message-ID: <20050405175537.GA21747@rcog.homelinux.net> On the message I sent on March 14, does anyone had the chance to try the modification? Or was it already fixed? (I haven't searched the archive extensively) Or maybe my message got catched by some spam filters? (it made it to the list archive though) Anyway, I would appreciate some feedback (through the list) Thanks From taj at www.linux.org.uk Tue Apr 5 14:42:28 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 21:42:28 +0100 (BST) Subject: [Rxtx] Closing a port from an event listener results in a deadlock In-Reply-To: <20050405175537.GA21747@rcog.homelinux.net> References: <20050405175537.GA21747@rcog.homelinux.net> Message-ID: On Tue, 5 Apr 2005 no_spam at somewhere.com wrote: > On the message I sent on March 14, does anyone had the chance to try the > modification? > > Or was it already fixed? (I haven't searched the archive extensively) > > Or maybe my message got catched by some spam filters? (it made it to the list > archive though) > > Anyway, I would appreciate some feedback (through the list) > The patch is here http://marc.theaimsgroup.com/?l=rxtx&m=111084488820288&w=2 I have applied this patch to a local copy but will not be doing formal testing for a couple weeks. I do not try to close ports from inside the eventListenter usually so I encourage any feedback also. If there are no problems reported, I expect this will go into rxtx 2.1-7. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Wed Apr 6 08:33:42 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Wed, 06 Apr 2005 15:33:42 +0100 Subject: [Rxtx] getting RXTX version Message-ID: <4253F346.50102@emation.pt> Hi, I want to make sure my deployments have the same version of RXTX jar and native lib. I know the version of the jar can be obtained in the Version class, but how can I obtain the native version ? I know RXTX prints to the console a warning if the version is different. Is there a way to programatically know is this is the case ? I would like to log that to our app's log thanks Ricardo From taj at www.linux.org.uk Wed Apr 6 15:10:20 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 6 Apr 2005 22:10:20 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4253F346.50102@emation.pt> References: <4253F346.50102@emation.pt> Message-ID: On Wed, 6 Apr 2005, Ricardo Trindade wrote: > Hi, > > I want to make sure my deployments have the same version of RXTX jar > and native lib. > > I know the version of the jar can be obtained in the Version class, > but how can I obtain the native version ? > > I know RXTX prints to the console a warning if the version is > different. Is there a way to programatically know is this is the case ? > > I would like to log that to our app's log > There isn't a suggested way of doing that right now. We could move things around and have a static String RXTXVersion.getNativeVersion() in future releases. Is this what you expected? This is not documented in commapi at all. I just tossed that in to catch conflicts while developing. It would be nice to have access in GUI applications though. It may be possible to access RXTXCommDriver.LibVersion right now. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Thu Apr 7 02:51:00 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 09:51:00 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> Message-ID: <4254F474.7020905@emation.pt> >There isn't a suggested way of doing that right now. We could move things >around and have a static String RXTXVersion.getNativeVersion() in future >releases. Is this what you expected? > > Yes, that would be perfect. >This is not documented in commapi at all. I just tossed that in to catch >conflicts while developing. It would be nice to have access in GUI >applications though. > >It may be possible to access RXTXCommDriver.LibVersion right now. > > > I tried, and I don't think it's possible. From taj at www.linux.org.uk Thu Apr 7 03:32:04 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 7 Apr 2005 10:32:04 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4254F474.7020905@emation.pt> References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: On Thu, 7 Apr 2005, Ricardo Trindade wrote: > > >There isn't a suggested way of doing that right now. We could move things > >around and have a static String RXTXVersion.getNativeVersion() in future > >releases. Is this what you expected? > > > > > > Yes, that would be perfect. > The attached should do what you want. You will still need to catch an exception for older versions... -- Trent Jarvi taj at www.linux.org.uk -------------- next part -------------- ? public_version.patch Index: RXTXCommDriver.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXCommDriver.java,v retrieving revision 1.16.2.51 diff -u -r1.16.2.51 RXTXCommDriver.java --- RXTXCommDriver.java 12 Oct 2004 09:13:30 -0000 1.16.2.51 +++ RXTXCommDriver.java 7 Apr 2005 09:29:04 -0000 @@ -54,7 +54,7 @@ the Library. */ String JarVersion = RXTXVersion.getVersion(); - String LibVersion = nativeGetVersion(); + String LibVersion = RXTXVersion.nativeGetVersion(); if ( devel ) { System.out.println("Devel Library"); @@ -76,7 +76,6 @@ /** Get the Serial port prefixes for the running OS */ private String deviceDirectory; private String osName; - private static native String nativeGetVersion(); private native boolean registerKnownPorts(int PortType); private native boolean isPortPrefixValid(String dev); private native boolean testRead(String dev, int type); Index: RXTXVersion.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXVersion.java,v retrieving revision 1.2.2.31 diff -u -r1.2.2.31 RXTXVersion.java --- RXTXVersion.java 16 Oct 2004 16:20:35 -0000 1.2.2.31 +++ RXTXVersion.java 7 Apr 2005 09:29:04 -0000 @@ -36,6 +36,7 @@ private static String Version; static { + System.loadLibrary( "rxtxSerial" ); Version = "RXTX-2.1-7pre20"; } /** @@ -47,4 +48,5 @@ { return(Version); } + public static native String nativeGetVersion(); } Index: SerialImp.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v retrieving revision 1.46.2.181 diff -u -r1.46.2.181 SerialImp.c --- SerialImp.c 17 Oct 2004 09:48:56 -0000 1.46.2.181 +++ SerialImp.c 7 Apr 2005 09:29:07 -0000 @@ -116,6 +116,7 @@ * It will eventually be removed. * */ #define RXTXPort(foo) Java_gnu_io_RXTXPort_ ## foo +#define RXTXVersion(foo) Java_gnu_io_RXTXVersion_ ## foo #define RXTXCommDriver(foo) Java_gnu_io_RXTXCommDriver_ ## foo #if defined(__sun__) || defined(__hpux__) @@ -4001,7 +4002,7 @@ } /*---------------------------------------------------------- -RXTXCommDriver.nativeGetVersion +RXTXVersion.nativeGetVersion accept: none perform: return the current version @@ -4010,9 +4011,10 @@ comments: This is used to avoid mixing versions of the .jar and native library. First introduced in rxtx-1.5-9 + Moved from RXTXCommDriver to RXTXVersion in rxtx-2.1-7 ----------------------------------------------------------*/ -JNIEXPORT jstring JNICALL RXTXCommDriver(nativeGetVersion) (JNIEnv *env, +JNIEXPORT jstring JNICALL RXTXVersion(nativeGetVersion) (JNIEnv *env, jclass jclazz ) { return (*env)->NewStringUTF( env, "RXTX-2.1-7pre20" ); From ricardo.trindade at emation.pt Thu Apr 7 03:45:58 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 10:45:58 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: <42550156.2040908@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050407/05212451/attachment-0041.html From thomas.shulok at lmco.com Thu Apr 7 17:43:11 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Thu, 07 Apr 2005 19:43:11 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi There, I'm attempting to talk RS232 between an embedded Linux box and a Windows box. Everything connects up fine, and I can send and receive a simple sequence of bytes with no problems. However, if around 5 seconds goes by without me sending something, I get the following when I attempt to send. java.io.IOException: Input/output error in writeArray Stack trace: java/lang/Throwable.()V java/lang/Throwable.(Ljava/lang/String;)V java/io/IOException.(Ljava/lang/String;)V gnu/io/RXTXPort.writeArray([BIIZ)V gnu/io/RXTXPort$SerialOutputStream.write([B)V SerialTest.main([Ljava/lang/String;)V If there interval is shorter (say 2 seconds between sends), I have no problems. On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and librxtxSerial-2.0.7pre2.so. Any ideas? Thanks, Thom -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5b23dcf/attachment-0041.html From taj at www.linux.org.uk Thu Apr 7 19:22:36 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:22:36 +0100 (BST) Subject: [Rxtx] Input/output error in writeArray In-Reply-To: References: Message-ID: On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a Windows > box. Everything connects up fine, and I can send and receive a simple > sequence of bytes with no problems. However, if around 5 seconds goes > by without me sending something, I get the following when I attempt to > send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Apr 7 19:24:59 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:24:59 +0100 (BST) Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) Message-ID: hmm. This would not work from applets would it? -- Trent Jarvi taj at www.linux.org.uk ---------- Forwarded message ---------- Date: Thu, 07 Apr 2005 16:05:53 -0400 From: Chris Gaffney To: taj at www.linux.org.uk Subject: RXTX Libraries on Classpath fix Hi, I submitted a patch for RXTX a few weeks ago to allow for loading the native libraries from the classpath. Since sending it to you I found it wasn't working on windows. I've fixed the problem and created a new patch that should replace the older one. The actual change is a one line from a String.equals() to a String.startsWith(). Thanks for a great piece of software, -Chris Gaffney Grand Valley State University -------------- next part -------------- A non-text attachment was scrubbed... Name: libraries_on_classpath_fixed.patch Type: text/x-patch Size: 5617 bytes Desc: Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5d423b8/libraries_on_classpath_fixed-0041.bin From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From thomas.shulok at lmco.com Fri Apr 8 10:38:55 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Fri, 08 Apr 2005 12:38:55 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi Trent, Thanks for the prompt response. Before diving deeper, I was wondering if there is a timeout parameter somewhere in the stack that I have not set properly. Given the nature of the failure (only fails if the line has been idle for a few seconds), it feels like some kind of timeout issue... Thanks again, Thom -----Original Message----- From: rxtx-bounces at mail.linuxgrrls.org [mailto:rxtx-bounces at mail.linuxgrrls.org] On Behalf Of Trent Jarvi Sent: Thursday, April 07, 2005 6:23 PM To: Java RXTX discussion Subject: Re: [Rxtx] Input/output error in writeArray On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a > Windows box. Everything connects up fine, and I can send and receive > a simple sequence of bytes with no problems. However, if around 5 > seconds goes by without me sending something, I get the following when > I attempt to send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at mail.linuxgrrls.org http://mail.linuxgrrls.org/mailman/listinfo/rxtx From ricardo.trindade at emation.pt Mon Apr 4 09:17:23 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Mon, 04 Apr 2005 16:17:23 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot Message-ID: <42515A83.4050907@emation.pt> Hi, I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most recent stable snapshot), and get the following exception : It looks like rxtx has been compiled with jdk 1.5. If this was indeed the case, I think there is a compilation flag that generates code that runs on older jdks. java.lang.UnsupportedClassVersionError: gnu/io/UnsupportedCommOperationException (Unsupported major.minor version 49.0) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at java.net.URLClassLoader.defineClass(URLClassLoader.java:251) at java.net.URLClassLoader.access$100(URLClassLoader.java:55) at java.net.URLClassLoader$1.run(URLClassLoader.java:194) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:187) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:141) I'm trying to run it with 1.4. thanks Ricardo From taj at www.linux.org.uk Tue Apr 5 00:48:12 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 07:48:12 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42515A83.4050907@emation.pt> References: <42515A83.4050907@emation.pt> Message-ID: On Mon, 4 Apr 2005, Ricardo Trindade wrote: > Hi, > > I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most > recent stable snapshot), and get the following exception : > > It looks like rxtx has been compiled with jdk 1.5. If this was > indeed the case, I think there is a compilation flag that generates code > that runs on older jdks. > > java.lang.UnsupportedClassVersionError: > gnu/io/UnsupportedCommOperationException (Unsupported major.minor > version 49.0) [snip] Thanks Ricardo I recompiled the jar with javac -source 1.3 -target 1.3. That should cover most of the JRE's in use today. I also compiled the rxtx 2.0 x86_64 native library which appeared to be missing. I tried looking for flags to pass gcc 4.0 to make the native libraries more backwards compatible but only found options for C++ which is not used in rxtx. I've got a list of other bugs that I'll be going through in the next few weeks but for now I just left them with the same CVS filename - no code changes. ftp://ftp.qbang.org/pub/rxtx/rxtx-2.0-CVS-20050120-bins.tar.gz ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-CVS-20050120-bins.tar.gz -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Tue Apr 5 02:24:33 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 05 Apr 2005 09:24:33 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: References: <42515A83.4050907@emation.pt> Message-ID: <42524B41.3040300@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050405/5919abbb/attachment-0042.html From taj at www.linux.org.uk Tue Apr 5 03:00:29 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 10:00:29 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42524B41.3040300@emation.pt> References: <42515A83.4050907@emation.pt> <42524B41.3040300@emation.pt> Message-ID: On Tue, 5 Apr 2005, Ricardo Trindade wrote: > Will you anounce to the list when a new release is available ? > There will be several incremental releases announced here. Once those are done, we will release 2.1.7 and 2.0.7. -- Trent Jarvi taj at www.linux.org.uk From no_spam at somewhere.com Tue Apr 5 11:55:37 2005 From: no_spam at somewhere.com (no_spam@somewhere.com) Date: Tue, 5 Apr 2005 13:55:37 -0400 Subject: [Rxtx] Closing a port from an event listener results in a deadlock Message-ID: <20050405175537.GA21747@rcog.homelinux.net> On the message I sent on March 14, does anyone had the chance to try the modification? Or was it already fixed? (I haven't searched the archive extensively) Or maybe my message got catched by some spam filters? (it made it to the list archive though) Anyway, I would appreciate some feedback (through the list) Thanks From taj at www.linux.org.uk Tue Apr 5 14:42:28 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 21:42:28 +0100 (BST) Subject: [Rxtx] Closing a port from an event listener results in a deadlock In-Reply-To: <20050405175537.GA21747@rcog.homelinux.net> References: <20050405175537.GA21747@rcog.homelinux.net> Message-ID: On Tue, 5 Apr 2005 no_spam at somewhere.com wrote: > On the message I sent on March 14, does anyone had the chance to try the > modification? > > Or was it already fixed? (I haven't searched the archive extensively) > > Or maybe my message got catched by some spam filters? (it made it to the list > archive though) > > Anyway, I would appreciate some feedback (through the list) > The patch is here http://marc.theaimsgroup.com/?l=rxtx&m=111084488820288&w=2 I have applied this patch to a local copy but will not be doing formal testing for a couple weeks. I do not try to close ports from inside the eventListenter usually so I encourage any feedback also. If there are no problems reported, I expect this will go into rxtx 2.1-7. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Wed Apr 6 08:33:42 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Wed, 06 Apr 2005 15:33:42 +0100 Subject: [Rxtx] getting RXTX version Message-ID: <4253F346.50102@emation.pt> Hi, I want to make sure my deployments have the same version of RXTX jar and native lib. I know the version of the jar can be obtained in the Version class, but how can I obtain the native version ? I know RXTX prints to the console a warning if the version is different. Is there a way to programatically know is this is the case ? I would like to log that to our app's log thanks Ricardo From taj at www.linux.org.uk Wed Apr 6 15:10:20 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 6 Apr 2005 22:10:20 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4253F346.50102@emation.pt> References: <4253F346.50102@emation.pt> Message-ID: On Wed, 6 Apr 2005, Ricardo Trindade wrote: > Hi, > > I want to make sure my deployments have the same version of RXTX jar > and native lib. > > I know the version of the jar can be obtained in the Version class, > but how can I obtain the native version ? > > I know RXTX prints to the console a warning if the version is > different. Is there a way to programatically know is this is the case ? > > I would like to log that to our app's log > There isn't a suggested way of doing that right now. We could move things around and have a static String RXTXVersion.getNativeVersion() in future releases. Is this what you expected? This is not documented in commapi at all. I just tossed that in to catch conflicts while developing. It would be nice to have access in GUI applications though. It may be possible to access RXTXCommDriver.LibVersion right now. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Thu Apr 7 02:51:00 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 09:51:00 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> Message-ID: <4254F474.7020905@emation.pt> >There isn't a suggested way of doing that right now. We could move things >around and have a static String RXTXVersion.getNativeVersion() in future >releases. Is this what you expected? > > Yes, that would be perfect. >This is not documented in commapi at all. I just tossed that in to catch >conflicts while developing. It would be nice to have access in GUI >applications though. > >It may be possible to access RXTXCommDriver.LibVersion right now. > > > I tried, and I don't think it's possible. From taj at www.linux.org.uk Thu Apr 7 03:32:04 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 7 Apr 2005 10:32:04 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4254F474.7020905@emation.pt> References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: On Thu, 7 Apr 2005, Ricardo Trindade wrote: > > >There isn't a suggested way of doing that right now. We could move things > >around and have a static String RXTXVersion.getNativeVersion() in future > >releases. Is this what you expected? > > > > > > Yes, that would be perfect. > The attached should do what you want. You will still need to catch an exception for older versions... -- Trent Jarvi taj at www.linux.org.uk -------------- next part -------------- ? public_version.patch Index: RXTXCommDriver.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXCommDriver.java,v retrieving revision 1.16.2.51 diff -u -r1.16.2.51 RXTXCommDriver.java --- RXTXCommDriver.java 12 Oct 2004 09:13:30 -0000 1.16.2.51 +++ RXTXCommDriver.java 7 Apr 2005 09:29:04 -0000 @@ -54,7 +54,7 @@ the Library. */ String JarVersion = RXTXVersion.getVersion(); - String LibVersion = nativeGetVersion(); + String LibVersion = RXTXVersion.nativeGetVersion(); if ( devel ) { System.out.println("Devel Library"); @@ -76,7 +76,6 @@ /** Get the Serial port prefixes for the running OS */ private String deviceDirectory; private String osName; - private static native String nativeGetVersion(); private native boolean registerKnownPorts(int PortType); private native boolean isPortPrefixValid(String dev); private native boolean testRead(String dev, int type); Index: RXTXVersion.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXVersion.java,v retrieving revision 1.2.2.31 diff -u -r1.2.2.31 RXTXVersion.java --- RXTXVersion.java 16 Oct 2004 16:20:35 -0000 1.2.2.31 +++ RXTXVersion.java 7 Apr 2005 09:29:04 -0000 @@ -36,6 +36,7 @@ private static String Version; static { + System.loadLibrary( "rxtxSerial" ); Version = "RXTX-2.1-7pre20"; } /** @@ -47,4 +48,5 @@ { return(Version); } + public static native String nativeGetVersion(); } Index: SerialImp.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v retrieving revision 1.46.2.181 diff -u -r1.46.2.181 SerialImp.c --- SerialImp.c 17 Oct 2004 09:48:56 -0000 1.46.2.181 +++ SerialImp.c 7 Apr 2005 09:29:07 -0000 @@ -116,6 +116,7 @@ * It will eventually be removed. * */ #define RXTXPort(foo) Java_gnu_io_RXTXPort_ ## foo +#define RXTXVersion(foo) Java_gnu_io_RXTXVersion_ ## foo #define RXTXCommDriver(foo) Java_gnu_io_RXTXCommDriver_ ## foo #if defined(__sun__) || defined(__hpux__) @@ -4001,7 +4002,7 @@ } /*---------------------------------------------------------- -RXTXCommDriver.nativeGetVersion +RXTXVersion.nativeGetVersion accept: none perform: return the current version @@ -4010,9 +4011,10 @@ comments: This is used to avoid mixing versions of the .jar and native library. First introduced in rxtx-1.5-9 + Moved from RXTXCommDriver to RXTXVersion in rxtx-2.1-7 ----------------------------------------------------------*/ -JNIEXPORT jstring JNICALL RXTXCommDriver(nativeGetVersion) (JNIEnv *env, +JNIEXPORT jstring JNICALL RXTXVersion(nativeGetVersion) (JNIEnv *env, jclass jclazz ) { return (*env)->NewStringUTF( env, "RXTX-2.1-7pre20" ); From ricardo.trindade at emation.pt Thu Apr 7 03:45:58 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 10:45:58 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: <42550156.2040908@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050407/05212451/attachment-0042.html From thomas.shulok at lmco.com Thu Apr 7 17:43:11 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Thu, 07 Apr 2005 19:43:11 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi There, I'm attempting to talk RS232 between an embedded Linux box and a Windows box. Everything connects up fine, and I can send and receive a simple sequence of bytes with no problems. However, if around 5 seconds goes by without me sending something, I get the following when I attempt to send. java.io.IOException: Input/output error in writeArray Stack trace: java/lang/Throwable.()V java/lang/Throwable.(Ljava/lang/String;)V java/io/IOException.(Ljava/lang/String;)V gnu/io/RXTXPort.writeArray([BIIZ)V gnu/io/RXTXPort$SerialOutputStream.write([B)V SerialTest.main([Ljava/lang/String;)V If there interval is shorter (say 2 seconds between sends), I have no problems. On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and librxtxSerial-2.0.7pre2.so. Any ideas? Thanks, Thom -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5b23dcf/attachment-0042.html From taj at www.linux.org.uk Thu Apr 7 19:22:36 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:22:36 +0100 (BST) Subject: [Rxtx] Input/output error in writeArray In-Reply-To: References: Message-ID: On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a Windows > box. Everything connects up fine, and I can send and receive a simple > sequence of bytes with no problems. However, if around 5 seconds goes > by without me sending something, I get the following when I attempt to > send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Apr 7 19:24:59 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:24:59 +0100 (BST) Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) Message-ID: hmm. This would not work from applets would it? -- Trent Jarvi taj at www.linux.org.uk ---------- Forwarded message ---------- Date: Thu, 07 Apr 2005 16:05:53 -0400 From: Chris Gaffney To: taj at www.linux.org.uk Subject: RXTX Libraries on Classpath fix Hi, I submitted a patch for RXTX a few weeks ago to allow for loading the native libraries from the classpath. Since sending it to you I found it wasn't working on windows. I've fixed the problem and created a new patch that should replace the older one. The actual change is a one line from a String.equals() to a String.startsWith(). Thanks for a great piece of software, -Chris Gaffney Grand Valley State University -------------- next part -------------- A non-text attachment was scrubbed... Name: libraries_on_classpath_fixed.patch Type: text/x-patch Size: 5617 bytes Desc: Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5d423b8/libraries_on_classpath_fixed-0042.bin From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From thomas.shulok at lmco.com Fri Apr 8 10:38:55 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Fri, 08 Apr 2005 12:38:55 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi Trent, Thanks for the prompt response. Before diving deeper, I was wondering if there is a timeout parameter somewhere in the stack that I have not set properly. Given the nature of the failure (only fails if the line has been idle for a few seconds), it feels like some kind of timeout issue... Thanks again, Thom -----Original Message----- From: rxtx-bounces at mail.linuxgrrls.org [mailto:rxtx-bounces at mail.linuxgrrls.org] On Behalf Of Trent Jarvi Sent: Thursday, April 07, 2005 6:23 PM To: Java RXTX discussion Subject: Re: [Rxtx] Input/output error in writeArray On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a > Windows box. Everything connects up fine, and I can send and receive > a simple sequence of bytes with no problems. However, if around 5 > seconds goes by without me sending something, I get the following when > I attempt to send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at mail.linuxgrrls.org http://mail.linuxgrrls.org/mailman/listinfo/rxtx From ricardo.trindade at emation.pt Mon Apr 4 09:17:23 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Mon, 04 Apr 2005 16:17:23 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot Message-ID: <42515A83.4050907@emation.pt> Hi, I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most recent stable snapshot), and get the following exception : It looks like rxtx has been compiled with jdk 1.5. If this was indeed the case, I think there is a compilation flag that generates code that runs on older jdks. java.lang.UnsupportedClassVersionError: gnu/io/UnsupportedCommOperationException (Unsupported major.minor version 49.0) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at java.net.URLClassLoader.defineClass(URLClassLoader.java:251) at java.net.URLClassLoader.access$100(URLClassLoader.java:55) at java.net.URLClassLoader$1.run(URLClassLoader.java:194) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:187) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:141) I'm trying to run it with 1.4. thanks Ricardo From taj at www.linux.org.uk Tue Apr 5 00:48:12 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 07:48:12 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42515A83.4050907@emation.pt> References: <42515A83.4050907@emation.pt> Message-ID: On Mon, 4 Apr 2005, Ricardo Trindade wrote: > Hi, > > I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most > recent stable snapshot), and get the following exception : > > It looks like rxtx has been compiled with jdk 1.5. If this was > indeed the case, I think there is a compilation flag that generates code > that runs on older jdks. > > java.lang.UnsupportedClassVersionError: > gnu/io/UnsupportedCommOperationException (Unsupported major.minor > version 49.0) [snip] Thanks Ricardo I recompiled the jar with javac -source 1.3 -target 1.3. That should cover most of the JRE's in use today. I also compiled the rxtx 2.0 x86_64 native library which appeared to be missing. I tried looking for flags to pass gcc 4.0 to make the native libraries more backwards compatible but only found options for C++ which is not used in rxtx. I've got a list of other bugs that I'll be going through in the next few weeks but for now I just left them with the same CVS filename - no code changes. ftp://ftp.qbang.org/pub/rxtx/rxtx-2.0-CVS-20050120-bins.tar.gz ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-CVS-20050120-bins.tar.gz -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Tue Apr 5 02:24:33 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 05 Apr 2005 09:24:33 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: References: <42515A83.4050907@emation.pt> Message-ID: <42524B41.3040300@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050405/5919abbb/attachment-0043.html From taj at www.linux.org.uk Tue Apr 5 03:00:29 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 10:00:29 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42524B41.3040300@emation.pt> References: <42515A83.4050907@emation.pt> <42524B41.3040300@emation.pt> Message-ID: On Tue, 5 Apr 2005, Ricardo Trindade wrote: > Will you anounce to the list when a new release is available ? > There will be several incremental releases announced here. Once those are done, we will release 2.1.7 and 2.0.7. -- Trent Jarvi taj at www.linux.org.uk From no_spam at somewhere.com Tue Apr 5 11:55:37 2005 From: no_spam at somewhere.com (no_spam@somewhere.com) Date: Tue, 5 Apr 2005 13:55:37 -0400 Subject: [Rxtx] Closing a port from an event listener results in a deadlock Message-ID: <20050405175537.GA21747@rcog.homelinux.net> On the message I sent on March 14, does anyone had the chance to try the modification? Or was it already fixed? (I haven't searched the archive extensively) Or maybe my message got catched by some spam filters? (it made it to the list archive though) Anyway, I would appreciate some feedback (through the list) Thanks From taj at www.linux.org.uk Tue Apr 5 14:42:28 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 21:42:28 +0100 (BST) Subject: [Rxtx] Closing a port from an event listener results in a deadlock In-Reply-To: <20050405175537.GA21747@rcog.homelinux.net> References: <20050405175537.GA21747@rcog.homelinux.net> Message-ID: On Tue, 5 Apr 2005 no_spam at somewhere.com wrote: > On the message I sent on March 14, does anyone had the chance to try the > modification? > > Or was it already fixed? (I haven't searched the archive extensively) > > Or maybe my message got catched by some spam filters? (it made it to the list > archive though) > > Anyway, I would appreciate some feedback (through the list) > The patch is here http://marc.theaimsgroup.com/?l=rxtx&m=111084488820288&w=2 I have applied this patch to a local copy but will not be doing formal testing for a couple weeks. I do not try to close ports from inside the eventListenter usually so I encourage any feedback also. If there are no problems reported, I expect this will go into rxtx 2.1-7. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Wed Apr 6 08:33:42 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Wed, 06 Apr 2005 15:33:42 +0100 Subject: [Rxtx] getting RXTX version Message-ID: <4253F346.50102@emation.pt> Hi, I want to make sure my deployments have the same version of RXTX jar and native lib. I know the version of the jar can be obtained in the Version class, but how can I obtain the native version ? I know RXTX prints to the console a warning if the version is different. Is there a way to programatically know is this is the case ? I would like to log that to our app's log thanks Ricardo From taj at www.linux.org.uk Wed Apr 6 15:10:20 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 6 Apr 2005 22:10:20 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4253F346.50102@emation.pt> References: <4253F346.50102@emation.pt> Message-ID: On Wed, 6 Apr 2005, Ricardo Trindade wrote: > Hi, > > I want to make sure my deployments have the same version of RXTX jar > and native lib. > > I know the version of the jar can be obtained in the Version class, > but how can I obtain the native version ? > > I know RXTX prints to the console a warning if the version is > different. Is there a way to programatically know is this is the case ? > > I would like to log that to our app's log > There isn't a suggested way of doing that right now. We could move things around and have a static String RXTXVersion.getNativeVersion() in future releases. Is this what you expected? This is not documented in commapi at all. I just tossed that in to catch conflicts while developing. It would be nice to have access in GUI applications though. It may be possible to access RXTXCommDriver.LibVersion right now. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Thu Apr 7 02:51:00 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 09:51:00 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> Message-ID: <4254F474.7020905@emation.pt> >There isn't a suggested way of doing that right now. We could move things >around and have a static String RXTXVersion.getNativeVersion() in future >releases. Is this what you expected? > > Yes, that would be perfect. >This is not documented in commapi at all. I just tossed that in to catch >conflicts while developing. It would be nice to have access in GUI >applications though. > >It may be possible to access RXTXCommDriver.LibVersion right now. > > > I tried, and I don't think it's possible. From taj at www.linux.org.uk Thu Apr 7 03:32:04 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 7 Apr 2005 10:32:04 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4254F474.7020905@emation.pt> References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: On Thu, 7 Apr 2005, Ricardo Trindade wrote: > > >There isn't a suggested way of doing that right now. We could move things > >around and have a static String RXTXVersion.getNativeVersion() in future > >releases. Is this what you expected? > > > > > > Yes, that would be perfect. > The attached should do what you want. You will still need to catch an exception for older versions... -- Trent Jarvi taj at www.linux.org.uk -------------- next part -------------- ? public_version.patch Index: RXTXCommDriver.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXCommDriver.java,v retrieving revision 1.16.2.51 diff -u -r1.16.2.51 RXTXCommDriver.java --- RXTXCommDriver.java 12 Oct 2004 09:13:30 -0000 1.16.2.51 +++ RXTXCommDriver.java 7 Apr 2005 09:29:04 -0000 @@ -54,7 +54,7 @@ the Library. */ String JarVersion = RXTXVersion.getVersion(); - String LibVersion = nativeGetVersion(); + String LibVersion = RXTXVersion.nativeGetVersion(); if ( devel ) { System.out.println("Devel Library"); @@ -76,7 +76,6 @@ /** Get the Serial port prefixes for the running OS */ private String deviceDirectory; private String osName; - private static native String nativeGetVersion(); private native boolean registerKnownPorts(int PortType); private native boolean isPortPrefixValid(String dev); private native boolean testRead(String dev, int type); Index: RXTXVersion.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXVersion.java,v retrieving revision 1.2.2.31 diff -u -r1.2.2.31 RXTXVersion.java --- RXTXVersion.java 16 Oct 2004 16:20:35 -0000 1.2.2.31 +++ RXTXVersion.java 7 Apr 2005 09:29:04 -0000 @@ -36,6 +36,7 @@ private static String Version; static { + System.loadLibrary( "rxtxSerial" ); Version = "RXTX-2.1-7pre20"; } /** @@ -47,4 +48,5 @@ { return(Version); } + public static native String nativeGetVersion(); } Index: SerialImp.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v retrieving revision 1.46.2.181 diff -u -r1.46.2.181 SerialImp.c --- SerialImp.c 17 Oct 2004 09:48:56 -0000 1.46.2.181 +++ SerialImp.c 7 Apr 2005 09:29:07 -0000 @@ -116,6 +116,7 @@ * It will eventually be removed. * */ #define RXTXPort(foo) Java_gnu_io_RXTXPort_ ## foo +#define RXTXVersion(foo) Java_gnu_io_RXTXVersion_ ## foo #define RXTXCommDriver(foo) Java_gnu_io_RXTXCommDriver_ ## foo #if defined(__sun__) || defined(__hpux__) @@ -4001,7 +4002,7 @@ } /*---------------------------------------------------------- -RXTXCommDriver.nativeGetVersion +RXTXVersion.nativeGetVersion accept: none perform: return the current version @@ -4010,9 +4011,10 @@ comments: This is used to avoid mixing versions of the .jar and native library. First introduced in rxtx-1.5-9 + Moved from RXTXCommDriver to RXTXVersion in rxtx-2.1-7 ----------------------------------------------------------*/ -JNIEXPORT jstring JNICALL RXTXCommDriver(nativeGetVersion) (JNIEnv *env, +JNIEXPORT jstring JNICALL RXTXVersion(nativeGetVersion) (JNIEnv *env, jclass jclazz ) { return (*env)->NewStringUTF( env, "RXTX-2.1-7pre20" ); From ricardo.trindade at emation.pt Thu Apr 7 03:45:58 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 10:45:58 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: <42550156.2040908@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050407/05212451/attachment-0043.html From thomas.shulok at lmco.com Thu Apr 7 17:43:11 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Thu, 07 Apr 2005 19:43:11 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi There, I'm attempting to talk RS232 between an embedded Linux box and a Windows box. Everything connects up fine, and I can send and receive a simple sequence of bytes with no problems. However, if around 5 seconds goes by without me sending something, I get the following when I attempt to send. java.io.IOException: Input/output error in writeArray Stack trace: java/lang/Throwable.()V java/lang/Throwable.(Ljava/lang/String;)V java/io/IOException.(Ljava/lang/String;)V gnu/io/RXTXPort.writeArray([BIIZ)V gnu/io/RXTXPort$SerialOutputStream.write([B)V SerialTest.main([Ljava/lang/String;)V If there interval is shorter (say 2 seconds between sends), I have no problems. On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and librxtxSerial-2.0.7pre2.so. Any ideas? Thanks, Thom -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5b23dcf/attachment-0043.html From taj at www.linux.org.uk Thu Apr 7 19:22:36 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:22:36 +0100 (BST) Subject: [Rxtx] Input/output error in writeArray In-Reply-To: References: Message-ID: On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a Windows > box. Everything connects up fine, and I can send and receive a simple > sequence of bytes with no problems. However, if around 5 seconds goes > by without me sending something, I get the following when I attempt to > send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Apr 7 19:24:59 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:24:59 +0100 (BST) Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) Message-ID: hmm. This would not work from applets would it? -- Trent Jarvi taj at www.linux.org.uk ---------- Forwarded message ---------- Date: Thu, 07 Apr 2005 16:05:53 -0400 From: Chris Gaffney To: taj at www.linux.org.uk Subject: RXTX Libraries on Classpath fix Hi, I submitted a patch for RXTX a few weeks ago to allow for loading the native libraries from the classpath. Since sending it to you I found it wasn't working on windows. I've fixed the problem and created a new patch that should replace the older one. The actual change is a one line from a String.equals() to a String.startsWith(). Thanks for a great piece of software, -Chris Gaffney Grand Valley State University -------------- next part -------------- A non-text attachment was scrubbed... Name: libraries_on_classpath_fixed.patch Type: text/x-patch Size: 5617 bytes Desc: Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5d423b8/libraries_on_classpath_fixed-0043.bin From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From thomas.shulok at lmco.com Fri Apr 8 10:38:55 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Fri, 08 Apr 2005 12:38:55 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi Trent, Thanks for the prompt response. Before diving deeper, I was wondering if there is a timeout parameter somewhere in the stack that I have not set properly. Given the nature of the failure (only fails if the line has been idle for a few seconds), it feels like some kind of timeout issue... Thanks again, Thom -----Original Message----- From: rxtx-bounces at mail.linuxgrrls.org [mailto:rxtx-bounces at mail.linuxgrrls.org] On Behalf Of Trent Jarvi Sent: Thursday, April 07, 2005 6:23 PM To: Java RXTX discussion Subject: Re: [Rxtx] Input/output error in writeArray On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a > Windows box. Everything connects up fine, and I can send and receive > a simple sequence of bytes with no problems. However, if around 5 > seconds goes by without me sending something, I get the following when > I attempt to send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at mail.linuxgrrls.org http://mail.linuxgrrls.org/mailman/listinfo/rxtx From ricardo.trindade at emation.pt Mon Apr 4 09:17:23 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Mon, 04 Apr 2005 16:17:23 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot Message-ID: <42515A83.4050907@emation.pt> Hi, I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most recent stable snapshot), and get the following exception : It looks like rxtx has been compiled with jdk 1.5. If this was indeed the case, I think there is a compilation flag that generates code that runs on older jdks. java.lang.UnsupportedClassVersionError: gnu/io/UnsupportedCommOperationException (Unsupported major.minor version 49.0) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at java.net.URLClassLoader.defineClass(URLClassLoader.java:251) at java.net.URLClassLoader.access$100(URLClassLoader.java:55) at java.net.URLClassLoader$1.run(URLClassLoader.java:194) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:187) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:141) I'm trying to run it with 1.4. thanks Ricardo From taj at www.linux.org.uk Tue Apr 5 00:48:12 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 07:48:12 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42515A83.4050907@emation.pt> References: <42515A83.4050907@emation.pt> Message-ID: On Mon, 4 Apr 2005, Ricardo Trindade wrote: > Hi, > > I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most > recent stable snapshot), and get the following exception : > > It looks like rxtx has been compiled with jdk 1.5. If this was > indeed the case, I think there is a compilation flag that generates code > that runs on older jdks. > > java.lang.UnsupportedClassVersionError: > gnu/io/UnsupportedCommOperationException (Unsupported major.minor > version 49.0) [snip] Thanks Ricardo I recompiled the jar with javac -source 1.3 -target 1.3. That should cover most of the JRE's in use today. I also compiled the rxtx 2.0 x86_64 native library which appeared to be missing. I tried looking for flags to pass gcc 4.0 to make the native libraries more backwards compatible but only found options for C++ which is not used in rxtx. I've got a list of other bugs that I'll be going through in the next few weeks but for now I just left them with the same CVS filename - no code changes. ftp://ftp.qbang.org/pub/rxtx/rxtx-2.0-CVS-20050120-bins.tar.gz ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-CVS-20050120-bins.tar.gz -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Tue Apr 5 02:24:33 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 05 Apr 2005 09:24:33 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: References: <42515A83.4050907@emation.pt> Message-ID: <42524B41.3040300@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050405/5919abbb/attachment-0044.html From taj at www.linux.org.uk Tue Apr 5 03:00:29 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 10:00:29 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42524B41.3040300@emation.pt> References: <42515A83.4050907@emation.pt> <42524B41.3040300@emation.pt> Message-ID: On Tue, 5 Apr 2005, Ricardo Trindade wrote: > Will you anounce to the list when a new release is available ? > There will be several incremental releases announced here. Once those are done, we will release 2.1.7 and 2.0.7. -- Trent Jarvi taj at www.linux.org.uk From no_spam at somewhere.com Tue Apr 5 11:55:37 2005 From: no_spam at somewhere.com (no_spam@somewhere.com) Date: Tue, 5 Apr 2005 13:55:37 -0400 Subject: [Rxtx] Closing a port from an event listener results in a deadlock Message-ID: <20050405175537.GA21747@rcog.homelinux.net> On the message I sent on March 14, does anyone had the chance to try the modification? Or was it already fixed? (I haven't searched the archive extensively) Or maybe my message got catched by some spam filters? (it made it to the list archive though) Anyway, I would appreciate some feedback (through the list) Thanks From taj at www.linux.org.uk Tue Apr 5 14:42:28 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 21:42:28 +0100 (BST) Subject: [Rxtx] Closing a port from an event listener results in a deadlock In-Reply-To: <20050405175537.GA21747@rcog.homelinux.net> References: <20050405175537.GA21747@rcog.homelinux.net> Message-ID: On Tue, 5 Apr 2005 no_spam at somewhere.com wrote: > On the message I sent on March 14, does anyone had the chance to try the > modification? > > Or was it already fixed? (I haven't searched the archive extensively) > > Or maybe my message got catched by some spam filters? (it made it to the list > archive though) > > Anyway, I would appreciate some feedback (through the list) > The patch is here http://marc.theaimsgroup.com/?l=rxtx&m=111084488820288&w=2 I have applied this patch to a local copy but will not be doing formal testing for a couple weeks. I do not try to close ports from inside the eventListenter usually so I encourage any feedback also. If there are no problems reported, I expect this will go into rxtx 2.1-7. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Wed Apr 6 08:33:42 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Wed, 06 Apr 2005 15:33:42 +0100 Subject: [Rxtx] getting RXTX version Message-ID: <4253F346.50102@emation.pt> Hi, I want to make sure my deployments have the same version of RXTX jar and native lib. I know the version of the jar can be obtained in the Version class, but how can I obtain the native version ? I know RXTX prints to the console a warning if the version is different. Is there a way to programatically know is this is the case ? I would like to log that to our app's log thanks Ricardo From taj at www.linux.org.uk Wed Apr 6 15:10:20 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 6 Apr 2005 22:10:20 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4253F346.50102@emation.pt> References: <4253F346.50102@emation.pt> Message-ID: On Wed, 6 Apr 2005, Ricardo Trindade wrote: > Hi, > > I want to make sure my deployments have the same version of RXTX jar > and native lib. > > I know the version of the jar can be obtained in the Version class, > but how can I obtain the native version ? > > I know RXTX prints to the console a warning if the version is > different. Is there a way to programatically know is this is the case ? > > I would like to log that to our app's log > There isn't a suggested way of doing that right now. We could move things around and have a static String RXTXVersion.getNativeVersion() in future releases. Is this what you expected? This is not documented in commapi at all. I just tossed that in to catch conflicts while developing. It would be nice to have access in GUI applications though. It may be possible to access RXTXCommDriver.LibVersion right now. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Thu Apr 7 02:51:00 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 09:51:00 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> Message-ID: <4254F474.7020905@emation.pt> >There isn't a suggested way of doing that right now. We could move things >around and have a static String RXTXVersion.getNativeVersion() in future >releases. Is this what you expected? > > Yes, that would be perfect. >This is not documented in commapi at all. I just tossed that in to catch >conflicts while developing. It would be nice to have access in GUI >applications though. > >It may be possible to access RXTXCommDriver.LibVersion right now. > > > I tried, and I don't think it's possible. From taj at www.linux.org.uk Thu Apr 7 03:32:04 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 7 Apr 2005 10:32:04 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4254F474.7020905@emation.pt> References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: On Thu, 7 Apr 2005, Ricardo Trindade wrote: > > >There isn't a suggested way of doing that right now. We could move things > >around and have a static String RXTXVersion.getNativeVersion() in future > >releases. Is this what you expected? > > > > > > Yes, that would be perfect. > The attached should do what you want. You will still need to catch an exception for older versions... -- Trent Jarvi taj at www.linux.org.uk -------------- next part -------------- ? public_version.patch Index: RXTXCommDriver.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXCommDriver.java,v retrieving revision 1.16.2.51 diff -u -r1.16.2.51 RXTXCommDriver.java --- RXTXCommDriver.java 12 Oct 2004 09:13:30 -0000 1.16.2.51 +++ RXTXCommDriver.java 7 Apr 2005 09:29:04 -0000 @@ -54,7 +54,7 @@ the Library. */ String JarVersion = RXTXVersion.getVersion(); - String LibVersion = nativeGetVersion(); + String LibVersion = RXTXVersion.nativeGetVersion(); if ( devel ) { System.out.println("Devel Library"); @@ -76,7 +76,6 @@ /** Get the Serial port prefixes for the running OS */ private String deviceDirectory; private String osName; - private static native String nativeGetVersion(); private native boolean registerKnownPorts(int PortType); private native boolean isPortPrefixValid(String dev); private native boolean testRead(String dev, int type); Index: RXTXVersion.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXVersion.java,v retrieving revision 1.2.2.31 diff -u -r1.2.2.31 RXTXVersion.java --- RXTXVersion.java 16 Oct 2004 16:20:35 -0000 1.2.2.31 +++ RXTXVersion.java 7 Apr 2005 09:29:04 -0000 @@ -36,6 +36,7 @@ private static String Version; static { + System.loadLibrary( "rxtxSerial" ); Version = "RXTX-2.1-7pre20"; } /** @@ -47,4 +48,5 @@ { return(Version); } + public static native String nativeGetVersion(); } Index: SerialImp.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v retrieving revision 1.46.2.181 diff -u -r1.46.2.181 SerialImp.c --- SerialImp.c 17 Oct 2004 09:48:56 -0000 1.46.2.181 +++ SerialImp.c 7 Apr 2005 09:29:07 -0000 @@ -116,6 +116,7 @@ * It will eventually be removed. * */ #define RXTXPort(foo) Java_gnu_io_RXTXPort_ ## foo +#define RXTXVersion(foo) Java_gnu_io_RXTXVersion_ ## foo #define RXTXCommDriver(foo) Java_gnu_io_RXTXCommDriver_ ## foo #if defined(__sun__) || defined(__hpux__) @@ -4001,7 +4002,7 @@ } /*---------------------------------------------------------- -RXTXCommDriver.nativeGetVersion +RXTXVersion.nativeGetVersion accept: none perform: return the current version @@ -4010,9 +4011,10 @@ comments: This is used to avoid mixing versions of the .jar and native library. First introduced in rxtx-1.5-9 + Moved from RXTXCommDriver to RXTXVersion in rxtx-2.1-7 ----------------------------------------------------------*/ -JNIEXPORT jstring JNICALL RXTXCommDriver(nativeGetVersion) (JNIEnv *env, +JNIEXPORT jstring JNICALL RXTXVersion(nativeGetVersion) (JNIEnv *env, jclass jclazz ) { return (*env)->NewStringUTF( env, "RXTX-2.1-7pre20" ); From ricardo.trindade at emation.pt Thu Apr 7 03:45:58 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 10:45:58 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: <42550156.2040908@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050407/05212451/attachment-0044.html From thomas.shulok at lmco.com Thu Apr 7 17:43:11 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Thu, 07 Apr 2005 19:43:11 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi There, I'm attempting to talk RS232 between an embedded Linux box and a Windows box. Everything connects up fine, and I can send and receive a simple sequence of bytes with no problems. However, if around 5 seconds goes by without me sending something, I get the following when I attempt to send. java.io.IOException: Input/output error in writeArray Stack trace: java/lang/Throwable.()V java/lang/Throwable.(Ljava/lang/String;)V java/io/IOException.(Ljava/lang/String;)V gnu/io/RXTXPort.writeArray([BIIZ)V gnu/io/RXTXPort$SerialOutputStream.write([B)V SerialTest.main([Ljava/lang/String;)V If there interval is shorter (say 2 seconds between sends), I have no problems. On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and librxtxSerial-2.0.7pre2.so. Any ideas? Thanks, Thom -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5b23dcf/attachment-0044.html From taj at www.linux.org.uk Thu Apr 7 19:22:36 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:22:36 +0100 (BST) Subject: [Rxtx] Input/output error in writeArray In-Reply-To: References: Message-ID: On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a Windows > box. Everything connects up fine, and I can send and receive a simple > sequence of bytes with no problems. However, if around 5 seconds goes > by without me sending something, I get the following when I attempt to > send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Apr 7 19:24:59 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:24:59 +0100 (BST) Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) Message-ID: hmm. This would not work from applets would it? -- Trent Jarvi taj at www.linux.org.uk ---------- Forwarded message ---------- Date: Thu, 07 Apr 2005 16:05:53 -0400 From: Chris Gaffney To: taj at www.linux.org.uk Subject: RXTX Libraries on Classpath fix Hi, I submitted a patch for RXTX a few weeks ago to allow for loading the native libraries from the classpath. Since sending it to you I found it wasn't working on windows. I've fixed the problem and created a new patch that should replace the older one. The actual change is a one line from a String.equals() to a String.startsWith(). Thanks for a great piece of software, -Chris Gaffney Grand Valley State University -------------- next part -------------- A non-text attachment was scrubbed... Name: libraries_on_classpath_fixed.patch Type: text/x-patch Size: 5617 bytes Desc: Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5d423b8/libraries_on_classpath_fixed-0044.bin From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From thomas.shulok at lmco.com Fri Apr 8 10:38:55 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Fri, 08 Apr 2005 12:38:55 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi Trent, Thanks for the prompt response. Before diving deeper, I was wondering if there is a timeout parameter somewhere in the stack that I have not set properly. Given the nature of the failure (only fails if the line has been idle for a few seconds), it feels like some kind of timeout issue... Thanks again, Thom -----Original Message----- From: rxtx-bounces at mail.linuxgrrls.org [mailto:rxtx-bounces at mail.linuxgrrls.org] On Behalf Of Trent Jarvi Sent: Thursday, April 07, 2005 6:23 PM To: Java RXTX discussion Subject: Re: [Rxtx] Input/output error in writeArray On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a > Windows box. Everything connects up fine, and I can send and receive > a simple sequence of bytes with no problems. However, if around 5 > seconds goes by without me sending something, I get the following when > I attempt to send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at mail.linuxgrrls.org http://mail.linuxgrrls.org/mailman/listinfo/rxtx From ricardo.trindade at emation.pt Mon Apr 4 09:17:23 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Mon, 04 Apr 2005 16:17:23 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot Message-ID: <42515A83.4050907@emation.pt> Hi, I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most recent stable snapshot), and get the following exception : It looks like rxtx has been compiled with jdk 1.5. If this was indeed the case, I think there is a compilation flag that generates code that runs on older jdks. java.lang.UnsupportedClassVersionError: gnu/io/UnsupportedCommOperationException (Unsupported major.minor version 49.0) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at java.net.URLClassLoader.defineClass(URLClassLoader.java:251) at java.net.URLClassLoader.access$100(URLClassLoader.java:55) at java.net.URLClassLoader$1.run(URLClassLoader.java:194) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:187) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:141) I'm trying to run it with 1.4. thanks Ricardo From taj at www.linux.org.uk Tue Apr 5 00:48:12 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 07:48:12 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42515A83.4050907@emation.pt> References: <42515A83.4050907@emation.pt> Message-ID: On Mon, 4 Apr 2005, Ricardo Trindade wrote: > Hi, > > I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most > recent stable snapshot), and get the following exception : > > It looks like rxtx has been compiled with jdk 1.5. If this was > indeed the case, I think there is a compilation flag that generates code > that runs on older jdks. > > java.lang.UnsupportedClassVersionError: > gnu/io/UnsupportedCommOperationException (Unsupported major.minor > version 49.0) [snip] Thanks Ricardo I recompiled the jar with javac -source 1.3 -target 1.3. That should cover most of the JRE's in use today. I also compiled the rxtx 2.0 x86_64 native library which appeared to be missing. I tried looking for flags to pass gcc 4.0 to make the native libraries more backwards compatible but only found options for C++ which is not used in rxtx. I've got a list of other bugs that I'll be going through in the next few weeks but for now I just left them with the same CVS filename - no code changes. ftp://ftp.qbang.org/pub/rxtx/rxtx-2.0-CVS-20050120-bins.tar.gz ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-CVS-20050120-bins.tar.gz -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Tue Apr 5 02:24:33 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 05 Apr 2005 09:24:33 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: References: <42515A83.4050907@emation.pt> Message-ID: <42524B41.3040300@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050405/5919abbb/attachment-0045.html From taj at www.linux.org.uk Tue Apr 5 03:00:29 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 10:00:29 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42524B41.3040300@emation.pt> References: <42515A83.4050907@emation.pt> <42524B41.3040300@emation.pt> Message-ID: On Tue, 5 Apr 2005, Ricardo Trindade wrote: > Will you anounce to the list when a new release is available ? > There will be several incremental releases announced here. Once those are done, we will release 2.1.7 and 2.0.7. -- Trent Jarvi taj at www.linux.org.uk From no_spam at somewhere.com Tue Apr 5 11:55:37 2005 From: no_spam at somewhere.com (no_spam@somewhere.com) Date: Tue, 5 Apr 2005 13:55:37 -0400 Subject: [Rxtx] Closing a port from an event listener results in a deadlock Message-ID: <20050405175537.GA21747@rcog.homelinux.net> On the message I sent on March 14, does anyone had the chance to try the modification? Or was it already fixed? (I haven't searched the archive extensively) Or maybe my message got catched by some spam filters? (it made it to the list archive though) Anyway, I would appreciate some feedback (through the list) Thanks From taj at www.linux.org.uk Tue Apr 5 14:42:28 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 21:42:28 +0100 (BST) Subject: [Rxtx] Closing a port from an event listener results in a deadlock In-Reply-To: <20050405175537.GA21747@rcog.homelinux.net> References: <20050405175537.GA21747@rcog.homelinux.net> Message-ID: On Tue, 5 Apr 2005 no_spam at somewhere.com wrote: > On the message I sent on March 14, does anyone had the chance to try the > modification? > > Or was it already fixed? (I haven't searched the archive extensively) > > Or maybe my message got catched by some spam filters? (it made it to the list > archive though) > > Anyway, I would appreciate some feedback (through the list) > The patch is here http://marc.theaimsgroup.com/?l=rxtx&m=111084488820288&w=2 I have applied this patch to a local copy but will not be doing formal testing for a couple weeks. I do not try to close ports from inside the eventListenter usually so I encourage any feedback also. If there are no problems reported, I expect this will go into rxtx 2.1-7. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Wed Apr 6 08:33:42 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Wed, 06 Apr 2005 15:33:42 +0100 Subject: [Rxtx] getting RXTX version Message-ID: <4253F346.50102@emation.pt> Hi, I want to make sure my deployments have the same version of RXTX jar and native lib. I know the version of the jar can be obtained in the Version class, but how can I obtain the native version ? I know RXTX prints to the console a warning if the version is different. Is there a way to programatically know is this is the case ? I would like to log that to our app's log thanks Ricardo From taj at www.linux.org.uk Wed Apr 6 15:10:20 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 6 Apr 2005 22:10:20 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4253F346.50102@emation.pt> References: <4253F346.50102@emation.pt> Message-ID: On Wed, 6 Apr 2005, Ricardo Trindade wrote: > Hi, > > I want to make sure my deployments have the same version of RXTX jar > and native lib. > > I know the version of the jar can be obtained in the Version class, > but how can I obtain the native version ? > > I know RXTX prints to the console a warning if the version is > different. Is there a way to programatically know is this is the case ? > > I would like to log that to our app's log > There isn't a suggested way of doing that right now. We could move things around and have a static String RXTXVersion.getNativeVersion() in future releases. Is this what you expected? This is not documented in commapi at all. I just tossed that in to catch conflicts while developing. It would be nice to have access in GUI applications though. It may be possible to access RXTXCommDriver.LibVersion right now. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Thu Apr 7 02:51:00 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 09:51:00 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> Message-ID: <4254F474.7020905@emation.pt> >There isn't a suggested way of doing that right now. We could move things >around and have a static String RXTXVersion.getNativeVersion() in future >releases. Is this what you expected? > > Yes, that would be perfect. >This is not documented in commapi at all. I just tossed that in to catch >conflicts while developing. It would be nice to have access in GUI >applications though. > >It may be possible to access RXTXCommDriver.LibVersion right now. > > > I tried, and I don't think it's possible. From taj at www.linux.org.uk Thu Apr 7 03:32:04 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 7 Apr 2005 10:32:04 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4254F474.7020905@emation.pt> References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: On Thu, 7 Apr 2005, Ricardo Trindade wrote: > > >There isn't a suggested way of doing that right now. We could move things > >around and have a static String RXTXVersion.getNativeVersion() in future > >releases. Is this what you expected? > > > > > > Yes, that would be perfect. > The attached should do what you want. You will still need to catch an exception for older versions... -- Trent Jarvi taj at www.linux.org.uk -------------- next part -------------- ? public_version.patch Index: RXTXCommDriver.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXCommDriver.java,v retrieving revision 1.16.2.51 diff -u -r1.16.2.51 RXTXCommDriver.java --- RXTXCommDriver.java 12 Oct 2004 09:13:30 -0000 1.16.2.51 +++ RXTXCommDriver.java 7 Apr 2005 09:29:04 -0000 @@ -54,7 +54,7 @@ the Library. */ String JarVersion = RXTXVersion.getVersion(); - String LibVersion = nativeGetVersion(); + String LibVersion = RXTXVersion.nativeGetVersion(); if ( devel ) { System.out.println("Devel Library"); @@ -76,7 +76,6 @@ /** Get the Serial port prefixes for the running OS */ private String deviceDirectory; private String osName; - private static native String nativeGetVersion(); private native boolean registerKnownPorts(int PortType); private native boolean isPortPrefixValid(String dev); private native boolean testRead(String dev, int type); Index: RXTXVersion.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXVersion.java,v retrieving revision 1.2.2.31 diff -u -r1.2.2.31 RXTXVersion.java --- RXTXVersion.java 16 Oct 2004 16:20:35 -0000 1.2.2.31 +++ RXTXVersion.java 7 Apr 2005 09:29:04 -0000 @@ -36,6 +36,7 @@ private static String Version; static { + System.loadLibrary( "rxtxSerial" ); Version = "RXTX-2.1-7pre20"; } /** @@ -47,4 +48,5 @@ { return(Version); } + public static native String nativeGetVersion(); } Index: SerialImp.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v retrieving revision 1.46.2.181 diff -u -r1.46.2.181 SerialImp.c --- SerialImp.c 17 Oct 2004 09:48:56 -0000 1.46.2.181 +++ SerialImp.c 7 Apr 2005 09:29:07 -0000 @@ -116,6 +116,7 @@ * It will eventually be removed. * */ #define RXTXPort(foo) Java_gnu_io_RXTXPort_ ## foo +#define RXTXVersion(foo) Java_gnu_io_RXTXVersion_ ## foo #define RXTXCommDriver(foo) Java_gnu_io_RXTXCommDriver_ ## foo #if defined(__sun__) || defined(__hpux__) @@ -4001,7 +4002,7 @@ } /*---------------------------------------------------------- -RXTXCommDriver.nativeGetVersion +RXTXVersion.nativeGetVersion accept: none perform: return the current version @@ -4010,9 +4011,10 @@ comments: This is used to avoid mixing versions of the .jar and native library. First introduced in rxtx-1.5-9 + Moved from RXTXCommDriver to RXTXVersion in rxtx-2.1-7 ----------------------------------------------------------*/ -JNIEXPORT jstring JNICALL RXTXCommDriver(nativeGetVersion) (JNIEnv *env, +JNIEXPORT jstring JNICALL RXTXVersion(nativeGetVersion) (JNIEnv *env, jclass jclazz ) { return (*env)->NewStringUTF( env, "RXTX-2.1-7pre20" ); From ricardo.trindade at emation.pt Thu Apr 7 03:45:58 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 10:45:58 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: <42550156.2040908@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050407/05212451/attachment-0045.html From thomas.shulok at lmco.com Thu Apr 7 17:43:11 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Thu, 07 Apr 2005 19:43:11 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi There, I'm attempting to talk RS232 between an embedded Linux box and a Windows box. Everything connects up fine, and I can send and receive a simple sequence of bytes with no problems. However, if around 5 seconds goes by without me sending something, I get the following when I attempt to send. java.io.IOException: Input/output error in writeArray Stack trace: java/lang/Throwable.()V java/lang/Throwable.(Ljava/lang/String;)V java/io/IOException.(Ljava/lang/String;)V gnu/io/RXTXPort.writeArray([BIIZ)V gnu/io/RXTXPort$SerialOutputStream.write([B)V SerialTest.main([Ljava/lang/String;)V If there interval is shorter (say 2 seconds between sends), I have no problems. On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and librxtxSerial-2.0.7pre2.so. Any ideas? Thanks, Thom -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5b23dcf/attachment-0045.html From taj at www.linux.org.uk Thu Apr 7 19:22:36 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:22:36 +0100 (BST) Subject: [Rxtx] Input/output error in writeArray In-Reply-To: References: Message-ID: On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a Windows > box. Everything connects up fine, and I can send and receive a simple > sequence of bytes with no problems. However, if around 5 seconds goes > by without me sending something, I get the following when I attempt to > send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Apr 7 19:24:59 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:24:59 +0100 (BST) Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) Message-ID: hmm. This would not work from applets would it? -- Trent Jarvi taj at www.linux.org.uk ---------- Forwarded message ---------- Date: Thu, 07 Apr 2005 16:05:53 -0400 From: Chris Gaffney To: taj at www.linux.org.uk Subject: RXTX Libraries on Classpath fix Hi, I submitted a patch for RXTX a few weeks ago to allow for loading the native libraries from the classpath. Since sending it to you I found it wasn't working on windows. I've fixed the problem and created a new patch that should replace the older one. The actual change is a one line from a String.equals() to a String.startsWith(). Thanks for a great piece of software, -Chris Gaffney Grand Valley State University -------------- next part -------------- A non-text attachment was scrubbed... Name: libraries_on_classpath_fixed.patch Type: text/x-patch Size: 5617 bytes Desc: Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5d423b8/libraries_on_classpath_fixed-0045.bin From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From thomas.shulok at lmco.com Fri Apr 8 10:38:55 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Fri, 08 Apr 2005 12:38:55 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi Trent, Thanks for the prompt response. Before diving deeper, I was wondering if there is a timeout parameter somewhere in the stack that I have not set properly. Given the nature of the failure (only fails if the line has been idle for a few seconds), it feels like some kind of timeout issue... Thanks again, Thom -----Original Message----- From: rxtx-bounces at mail.linuxgrrls.org [mailto:rxtx-bounces at mail.linuxgrrls.org] On Behalf Of Trent Jarvi Sent: Thursday, April 07, 2005 6:23 PM To: Java RXTX discussion Subject: Re: [Rxtx] Input/output error in writeArray On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a > Windows box. Everything connects up fine, and I can send and receive > a simple sequence of bytes with no problems. However, if around 5 > seconds goes by without me sending something, I get the following when > I attempt to send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at mail.linuxgrrls.org http://mail.linuxgrrls.org/mailman/listinfo/rxtx From ricardo.trindade at emation.pt Mon Apr 4 09:17:23 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Mon, 04 Apr 2005 16:17:23 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot Message-ID: <42515A83.4050907@emation.pt> Hi, I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most recent stable snapshot), and get the following exception : It looks like rxtx has been compiled with jdk 1.5. If this was indeed the case, I think there is a compilation flag that generates code that runs on older jdks. java.lang.UnsupportedClassVersionError: gnu/io/UnsupportedCommOperationException (Unsupported major.minor version 49.0) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at java.net.URLClassLoader.defineClass(URLClassLoader.java:251) at java.net.URLClassLoader.access$100(URLClassLoader.java:55) at java.net.URLClassLoader$1.run(URLClassLoader.java:194) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:187) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:141) I'm trying to run it with 1.4. thanks Ricardo From taj at www.linux.org.uk Tue Apr 5 00:48:12 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 07:48:12 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42515A83.4050907@emation.pt> References: <42515A83.4050907@emation.pt> Message-ID: On Mon, 4 Apr 2005, Ricardo Trindade wrote: > Hi, > > I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most > recent stable snapshot), and get the following exception : > > It looks like rxtx has been compiled with jdk 1.5. If this was > indeed the case, I think there is a compilation flag that generates code > that runs on older jdks. > > java.lang.UnsupportedClassVersionError: > gnu/io/UnsupportedCommOperationException (Unsupported major.minor > version 49.0) [snip] Thanks Ricardo I recompiled the jar with javac -source 1.3 -target 1.3. That should cover most of the JRE's in use today. I also compiled the rxtx 2.0 x86_64 native library which appeared to be missing. I tried looking for flags to pass gcc 4.0 to make the native libraries more backwards compatible but only found options for C++ which is not used in rxtx. I've got a list of other bugs that I'll be going through in the next few weeks but for now I just left them with the same CVS filename - no code changes. ftp://ftp.qbang.org/pub/rxtx/rxtx-2.0-CVS-20050120-bins.tar.gz ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-CVS-20050120-bins.tar.gz -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Tue Apr 5 02:24:33 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 05 Apr 2005 09:24:33 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: References: <42515A83.4050907@emation.pt> Message-ID: <42524B41.3040300@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050405/5919abbb/attachment-0046.html From taj at www.linux.org.uk Tue Apr 5 03:00:29 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 10:00:29 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42524B41.3040300@emation.pt> References: <42515A83.4050907@emation.pt> <42524B41.3040300@emation.pt> Message-ID: On Tue, 5 Apr 2005, Ricardo Trindade wrote: > Will you anounce to the list when a new release is available ? > There will be several incremental releases announced here. Once those are done, we will release 2.1.7 and 2.0.7. -- Trent Jarvi taj at www.linux.org.uk From no_spam at somewhere.com Tue Apr 5 11:55:37 2005 From: no_spam at somewhere.com (no_spam@somewhere.com) Date: Tue, 5 Apr 2005 13:55:37 -0400 Subject: [Rxtx] Closing a port from an event listener results in a deadlock Message-ID: <20050405175537.GA21747@rcog.homelinux.net> On the message I sent on March 14, does anyone had the chance to try the modification? Or was it already fixed? (I haven't searched the archive extensively) Or maybe my message got catched by some spam filters? (it made it to the list archive though) Anyway, I would appreciate some feedback (through the list) Thanks From taj at www.linux.org.uk Tue Apr 5 14:42:28 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 21:42:28 +0100 (BST) Subject: [Rxtx] Closing a port from an event listener results in a deadlock In-Reply-To: <20050405175537.GA21747@rcog.homelinux.net> References: <20050405175537.GA21747@rcog.homelinux.net> Message-ID: On Tue, 5 Apr 2005 no_spam at somewhere.com wrote: > On the message I sent on March 14, does anyone had the chance to try the > modification? > > Or was it already fixed? (I haven't searched the archive extensively) > > Or maybe my message got catched by some spam filters? (it made it to the list > archive though) > > Anyway, I would appreciate some feedback (through the list) > The patch is here http://marc.theaimsgroup.com/?l=rxtx&m=111084488820288&w=2 I have applied this patch to a local copy but will not be doing formal testing for a couple weeks. I do not try to close ports from inside the eventListenter usually so I encourage any feedback also. If there are no problems reported, I expect this will go into rxtx 2.1-7. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Wed Apr 6 08:33:42 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Wed, 06 Apr 2005 15:33:42 +0100 Subject: [Rxtx] getting RXTX version Message-ID: <4253F346.50102@emation.pt> Hi, I want to make sure my deployments have the same version of RXTX jar and native lib. I know the version of the jar can be obtained in the Version class, but how can I obtain the native version ? I know RXTX prints to the console a warning if the version is different. Is there a way to programatically know is this is the case ? I would like to log that to our app's log thanks Ricardo From taj at www.linux.org.uk Wed Apr 6 15:10:20 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 6 Apr 2005 22:10:20 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4253F346.50102@emation.pt> References: <4253F346.50102@emation.pt> Message-ID: On Wed, 6 Apr 2005, Ricardo Trindade wrote: > Hi, > > I want to make sure my deployments have the same version of RXTX jar > and native lib. > > I know the version of the jar can be obtained in the Version class, > but how can I obtain the native version ? > > I know RXTX prints to the console a warning if the version is > different. Is there a way to programatically know is this is the case ? > > I would like to log that to our app's log > There isn't a suggested way of doing that right now. We could move things around and have a static String RXTXVersion.getNativeVersion() in future releases. Is this what you expected? This is not documented in commapi at all. I just tossed that in to catch conflicts while developing. It would be nice to have access in GUI applications though. It may be possible to access RXTXCommDriver.LibVersion right now. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Thu Apr 7 02:51:00 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 09:51:00 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> Message-ID: <4254F474.7020905@emation.pt> >There isn't a suggested way of doing that right now. We could move things >around and have a static String RXTXVersion.getNativeVersion() in future >releases. Is this what you expected? > > Yes, that would be perfect. >This is not documented in commapi at all. I just tossed that in to catch >conflicts while developing. It would be nice to have access in GUI >applications though. > >It may be possible to access RXTXCommDriver.LibVersion right now. > > > I tried, and I don't think it's possible. From taj at www.linux.org.uk Thu Apr 7 03:32:04 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 7 Apr 2005 10:32:04 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4254F474.7020905@emation.pt> References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: On Thu, 7 Apr 2005, Ricardo Trindade wrote: > > >There isn't a suggested way of doing that right now. We could move things > >around and have a static String RXTXVersion.getNativeVersion() in future > >releases. Is this what you expected? > > > > > > Yes, that would be perfect. > The attached should do what you want. You will still need to catch an exception for older versions... -- Trent Jarvi taj at www.linux.org.uk -------------- next part -------------- ? public_version.patch Index: RXTXCommDriver.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXCommDriver.java,v retrieving revision 1.16.2.51 diff -u -r1.16.2.51 RXTXCommDriver.java --- RXTXCommDriver.java 12 Oct 2004 09:13:30 -0000 1.16.2.51 +++ RXTXCommDriver.java 7 Apr 2005 09:29:04 -0000 @@ -54,7 +54,7 @@ the Library. */ String JarVersion = RXTXVersion.getVersion(); - String LibVersion = nativeGetVersion(); + String LibVersion = RXTXVersion.nativeGetVersion(); if ( devel ) { System.out.println("Devel Library"); @@ -76,7 +76,6 @@ /** Get the Serial port prefixes for the running OS */ private String deviceDirectory; private String osName; - private static native String nativeGetVersion(); private native boolean registerKnownPorts(int PortType); private native boolean isPortPrefixValid(String dev); private native boolean testRead(String dev, int type); Index: RXTXVersion.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXVersion.java,v retrieving revision 1.2.2.31 diff -u -r1.2.2.31 RXTXVersion.java --- RXTXVersion.java 16 Oct 2004 16:20:35 -0000 1.2.2.31 +++ RXTXVersion.java 7 Apr 2005 09:29:04 -0000 @@ -36,6 +36,7 @@ private static String Version; static { + System.loadLibrary( "rxtxSerial" ); Version = "RXTX-2.1-7pre20"; } /** @@ -47,4 +48,5 @@ { return(Version); } + public static native String nativeGetVersion(); } Index: SerialImp.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v retrieving revision 1.46.2.181 diff -u -r1.46.2.181 SerialImp.c --- SerialImp.c 17 Oct 2004 09:48:56 -0000 1.46.2.181 +++ SerialImp.c 7 Apr 2005 09:29:07 -0000 @@ -116,6 +116,7 @@ * It will eventually be removed. * */ #define RXTXPort(foo) Java_gnu_io_RXTXPort_ ## foo +#define RXTXVersion(foo) Java_gnu_io_RXTXVersion_ ## foo #define RXTXCommDriver(foo) Java_gnu_io_RXTXCommDriver_ ## foo #if defined(__sun__) || defined(__hpux__) @@ -4001,7 +4002,7 @@ } /*---------------------------------------------------------- -RXTXCommDriver.nativeGetVersion +RXTXVersion.nativeGetVersion accept: none perform: return the current version @@ -4010,9 +4011,10 @@ comments: This is used to avoid mixing versions of the .jar and native library. First introduced in rxtx-1.5-9 + Moved from RXTXCommDriver to RXTXVersion in rxtx-2.1-7 ----------------------------------------------------------*/ -JNIEXPORT jstring JNICALL RXTXCommDriver(nativeGetVersion) (JNIEnv *env, +JNIEXPORT jstring JNICALL RXTXVersion(nativeGetVersion) (JNIEnv *env, jclass jclazz ) { return (*env)->NewStringUTF( env, "RXTX-2.1-7pre20" ); From ricardo.trindade at emation.pt Thu Apr 7 03:45:58 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 10:45:58 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: <42550156.2040908@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050407/05212451/attachment-0046.html From thomas.shulok at lmco.com Thu Apr 7 17:43:11 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Thu, 07 Apr 2005 19:43:11 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi There, I'm attempting to talk RS232 between an embedded Linux box and a Windows box. Everything connects up fine, and I can send and receive a simple sequence of bytes with no problems. However, if around 5 seconds goes by without me sending something, I get the following when I attempt to send. java.io.IOException: Input/output error in writeArray Stack trace: java/lang/Throwable.()V java/lang/Throwable.(Ljava/lang/String;)V java/io/IOException.(Ljava/lang/String;)V gnu/io/RXTXPort.writeArray([BIIZ)V gnu/io/RXTXPort$SerialOutputStream.write([B)V SerialTest.main([Ljava/lang/String;)V If there interval is shorter (say 2 seconds between sends), I have no problems. On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and librxtxSerial-2.0.7pre2.so. Any ideas? Thanks, Thom -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5b23dcf/attachment-0046.html From taj at www.linux.org.uk Thu Apr 7 19:22:36 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:22:36 +0100 (BST) Subject: [Rxtx] Input/output error in writeArray In-Reply-To: References: Message-ID: On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a Windows > box. Everything connects up fine, and I can send and receive a simple > sequence of bytes with no problems. However, if around 5 seconds goes > by without me sending something, I get the following when I attempt to > send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Apr 7 19:24:59 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:24:59 +0100 (BST) Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) Message-ID: hmm. This would not work from applets would it? -- Trent Jarvi taj at www.linux.org.uk ---------- Forwarded message ---------- Date: Thu, 07 Apr 2005 16:05:53 -0400 From: Chris Gaffney To: taj at www.linux.org.uk Subject: RXTX Libraries on Classpath fix Hi, I submitted a patch for RXTX a few weeks ago to allow for loading the native libraries from the classpath. Since sending it to you I found it wasn't working on windows. I've fixed the problem and created a new patch that should replace the older one. The actual change is a one line from a String.equals() to a String.startsWith(). Thanks for a great piece of software, -Chris Gaffney Grand Valley State University -------------- next part -------------- A non-text attachment was scrubbed... Name: libraries_on_classpath_fixed.patch Type: text/x-patch Size: 5617 bytes Desc: Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5d423b8/libraries_on_classpath_fixed-0046.bin From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From thomas.shulok at lmco.com Fri Apr 8 10:38:55 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Fri, 08 Apr 2005 12:38:55 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi Trent, Thanks for the prompt response. Before diving deeper, I was wondering if there is a timeout parameter somewhere in the stack that I have not set properly. Given the nature of the failure (only fails if the line has been idle for a few seconds), it feels like some kind of timeout issue... Thanks again, Thom -----Original Message----- From: rxtx-bounces at mail.linuxgrrls.org [mailto:rxtx-bounces at mail.linuxgrrls.org] On Behalf Of Trent Jarvi Sent: Thursday, April 07, 2005 6:23 PM To: Java RXTX discussion Subject: Re: [Rxtx] Input/output error in writeArray On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a > Windows box. Everything connects up fine, and I can send and receive > a simple sequence of bytes with no problems. However, if around 5 > seconds goes by without me sending something, I get the following when > I attempt to send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at mail.linuxgrrls.org http://mail.linuxgrrls.org/mailman/listinfo/rxtx From ricardo.trindade at emation.pt Mon Apr 4 09:17:23 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Mon, 04 Apr 2005 16:17:23 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot Message-ID: <42515A83.4050907@emation.pt> Hi, I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most recent stable snapshot), and get the following exception : It looks like rxtx has been compiled with jdk 1.5. If this was indeed the case, I think there is a compilation flag that generates code that runs on older jdks. java.lang.UnsupportedClassVersionError: gnu/io/UnsupportedCommOperationException (Unsupported major.minor version 49.0) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at java.net.URLClassLoader.defineClass(URLClassLoader.java:251) at java.net.URLClassLoader.access$100(URLClassLoader.java:55) at java.net.URLClassLoader$1.run(URLClassLoader.java:194) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:187) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:141) I'm trying to run it with 1.4. thanks Ricardo From taj at www.linux.org.uk Tue Apr 5 00:48:12 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 07:48:12 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42515A83.4050907@emation.pt> References: <42515A83.4050907@emation.pt> Message-ID: On Mon, 4 Apr 2005, Ricardo Trindade wrote: > Hi, > > I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most > recent stable snapshot), and get the following exception : > > It looks like rxtx has been compiled with jdk 1.5. If this was > indeed the case, I think there is a compilation flag that generates code > that runs on older jdks. > > java.lang.UnsupportedClassVersionError: > gnu/io/UnsupportedCommOperationException (Unsupported major.minor > version 49.0) [snip] Thanks Ricardo I recompiled the jar with javac -source 1.3 -target 1.3. That should cover most of the JRE's in use today. I also compiled the rxtx 2.0 x86_64 native library which appeared to be missing. I tried looking for flags to pass gcc 4.0 to make the native libraries more backwards compatible but only found options for C++ which is not used in rxtx. I've got a list of other bugs that I'll be going through in the next few weeks but for now I just left them with the same CVS filename - no code changes. ftp://ftp.qbang.org/pub/rxtx/rxtx-2.0-CVS-20050120-bins.tar.gz ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-CVS-20050120-bins.tar.gz -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Tue Apr 5 02:24:33 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 05 Apr 2005 09:24:33 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: References: <42515A83.4050907@emation.pt> Message-ID: <42524B41.3040300@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050405/5919abbb/attachment-0047.html From taj at www.linux.org.uk Tue Apr 5 03:00:29 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 10:00:29 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42524B41.3040300@emation.pt> References: <42515A83.4050907@emation.pt> <42524B41.3040300@emation.pt> Message-ID: On Tue, 5 Apr 2005, Ricardo Trindade wrote: > Will you anounce to the list when a new release is available ? > There will be several incremental releases announced here. Once those are done, we will release 2.1.7 and 2.0.7. -- Trent Jarvi taj at www.linux.org.uk From no_spam at somewhere.com Tue Apr 5 11:55:37 2005 From: no_spam at somewhere.com (no_spam@somewhere.com) Date: Tue, 5 Apr 2005 13:55:37 -0400 Subject: [Rxtx] Closing a port from an event listener results in a deadlock Message-ID: <20050405175537.GA21747@rcog.homelinux.net> On the message I sent on March 14, does anyone had the chance to try the modification? Or was it already fixed? (I haven't searched the archive extensively) Or maybe my message got catched by some spam filters? (it made it to the list archive though) Anyway, I would appreciate some feedback (through the list) Thanks From taj at www.linux.org.uk Tue Apr 5 14:42:28 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 21:42:28 +0100 (BST) Subject: [Rxtx] Closing a port from an event listener results in a deadlock In-Reply-To: <20050405175537.GA21747@rcog.homelinux.net> References: <20050405175537.GA21747@rcog.homelinux.net> Message-ID: On Tue, 5 Apr 2005 no_spam at somewhere.com wrote: > On the message I sent on March 14, does anyone had the chance to try the > modification? > > Or was it already fixed? (I haven't searched the archive extensively) > > Or maybe my message got catched by some spam filters? (it made it to the list > archive though) > > Anyway, I would appreciate some feedback (through the list) > The patch is here http://marc.theaimsgroup.com/?l=rxtx&m=111084488820288&w=2 I have applied this patch to a local copy but will not be doing formal testing for a couple weeks. I do not try to close ports from inside the eventListenter usually so I encourage any feedback also. If there are no problems reported, I expect this will go into rxtx 2.1-7. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Wed Apr 6 08:33:42 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Wed, 06 Apr 2005 15:33:42 +0100 Subject: [Rxtx] getting RXTX version Message-ID: <4253F346.50102@emation.pt> Hi, I want to make sure my deployments have the same version of RXTX jar and native lib. I know the version of the jar can be obtained in the Version class, but how can I obtain the native version ? I know RXTX prints to the console a warning if the version is different. Is there a way to programatically know is this is the case ? I would like to log that to our app's log thanks Ricardo From taj at www.linux.org.uk Wed Apr 6 15:10:20 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 6 Apr 2005 22:10:20 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4253F346.50102@emation.pt> References: <4253F346.50102@emation.pt> Message-ID: On Wed, 6 Apr 2005, Ricardo Trindade wrote: > Hi, > > I want to make sure my deployments have the same version of RXTX jar > and native lib. > > I know the version of the jar can be obtained in the Version class, > but how can I obtain the native version ? > > I know RXTX prints to the console a warning if the version is > different. Is there a way to programatically know is this is the case ? > > I would like to log that to our app's log > There isn't a suggested way of doing that right now. We could move things around and have a static String RXTXVersion.getNativeVersion() in future releases. Is this what you expected? This is not documented in commapi at all. I just tossed that in to catch conflicts while developing. It would be nice to have access in GUI applications though. It may be possible to access RXTXCommDriver.LibVersion right now. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Thu Apr 7 02:51:00 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 09:51:00 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> Message-ID: <4254F474.7020905@emation.pt> >There isn't a suggested way of doing that right now. We could move things >around and have a static String RXTXVersion.getNativeVersion() in future >releases. Is this what you expected? > > Yes, that would be perfect. >This is not documented in commapi at all. I just tossed that in to catch >conflicts while developing. It would be nice to have access in GUI >applications though. > >It may be possible to access RXTXCommDriver.LibVersion right now. > > > I tried, and I don't think it's possible. From taj at www.linux.org.uk Thu Apr 7 03:32:04 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 7 Apr 2005 10:32:04 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4254F474.7020905@emation.pt> References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: On Thu, 7 Apr 2005, Ricardo Trindade wrote: > > >There isn't a suggested way of doing that right now. We could move things > >around and have a static String RXTXVersion.getNativeVersion() in future > >releases. Is this what you expected? > > > > > > Yes, that would be perfect. > The attached should do what you want. You will still need to catch an exception for older versions... -- Trent Jarvi taj at www.linux.org.uk -------------- next part -------------- ? public_version.patch Index: RXTXCommDriver.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXCommDriver.java,v retrieving revision 1.16.2.51 diff -u -r1.16.2.51 RXTXCommDriver.java --- RXTXCommDriver.java 12 Oct 2004 09:13:30 -0000 1.16.2.51 +++ RXTXCommDriver.java 7 Apr 2005 09:29:04 -0000 @@ -54,7 +54,7 @@ the Library. */ String JarVersion = RXTXVersion.getVersion(); - String LibVersion = nativeGetVersion(); + String LibVersion = RXTXVersion.nativeGetVersion(); if ( devel ) { System.out.println("Devel Library"); @@ -76,7 +76,6 @@ /** Get the Serial port prefixes for the running OS */ private String deviceDirectory; private String osName; - private static native String nativeGetVersion(); private native boolean registerKnownPorts(int PortType); private native boolean isPortPrefixValid(String dev); private native boolean testRead(String dev, int type); Index: RXTXVersion.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXVersion.java,v retrieving revision 1.2.2.31 diff -u -r1.2.2.31 RXTXVersion.java --- RXTXVersion.java 16 Oct 2004 16:20:35 -0000 1.2.2.31 +++ RXTXVersion.java 7 Apr 2005 09:29:04 -0000 @@ -36,6 +36,7 @@ private static String Version; static { + System.loadLibrary( "rxtxSerial" ); Version = "RXTX-2.1-7pre20"; } /** @@ -47,4 +48,5 @@ { return(Version); } + public static native String nativeGetVersion(); } Index: SerialImp.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v retrieving revision 1.46.2.181 diff -u -r1.46.2.181 SerialImp.c --- SerialImp.c 17 Oct 2004 09:48:56 -0000 1.46.2.181 +++ SerialImp.c 7 Apr 2005 09:29:07 -0000 @@ -116,6 +116,7 @@ * It will eventually be removed. * */ #define RXTXPort(foo) Java_gnu_io_RXTXPort_ ## foo +#define RXTXVersion(foo) Java_gnu_io_RXTXVersion_ ## foo #define RXTXCommDriver(foo) Java_gnu_io_RXTXCommDriver_ ## foo #if defined(__sun__) || defined(__hpux__) @@ -4001,7 +4002,7 @@ } /*---------------------------------------------------------- -RXTXCommDriver.nativeGetVersion +RXTXVersion.nativeGetVersion accept: none perform: return the current version @@ -4010,9 +4011,10 @@ comments: This is used to avoid mixing versions of the .jar and native library. First introduced in rxtx-1.5-9 + Moved from RXTXCommDriver to RXTXVersion in rxtx-2.1-7 ----------------------------------------------------------*/ -JNIEXPORT jstring JNICALL RXTXCommDriver(nativeGetVersion) (JNIEnv *env, +JNIEXPORT jstring JNICALL RXTXVersion(nativeGetVersion) (JNIEnv *env, jclass jclazz ) { return (*env)->NewStringUTF( env, "RXTX-2.1-7pre20" ); From ricardo.trindade at emation.pt Thu Apr 7 03:45:58 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 10:45:58 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: <42550156.2040908@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050407/05212451/attachment-0047.html From thomas.shulok at lmco.com Thu Apr 7 17:43:11 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Thu, 07 Apr 2005 19:43:11 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi There, I'm attempting to talk RS232 between an embedded Linux box and a Windows box. Everything connects up fine, and I can send and receive a simple sequence of bytes with no problems. However, if around 5 seconds goes by without me sending something, I get the following when I attempt to send. java.io.IOException: Input/output error in writeArray Stack trace: java/lang/Throwable.()V java/lang/Throwable.(Ljava/lang/String;)V java/io/IOException.(Ljava/lang/String;)V gnu/io/RXTXPort.writeArray([BIIZ)V gnu/io/RXTXPort$SerialOutputStream.write([B)V SerialTest.main([Ljava/lang/String;)V If there interval is shorter (say 2 seconds between sends), I have no problems. On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and librxtxSerial-2.0.7pre2.so. Any ideas? Thanks, Thom -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5b23dcf/attachment-0047.html From taj at www.linux.org.uk Thu Apr 7 19:22:36 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:22:36 +0100 (BST) Subject: [Rxtx] Input/output error in writeArray In-Reply-To: References: Message-ID: On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a Windows > box. Everything connects up fine, and I can send and receive a simple > sequence of bytes with no problems. However, if around 5 seconds goes > by without me sending something, I get the following when I attempt to > send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Apr 7 19:24:59 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:24:59 +0100 (BST) Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) Message-ID: hmm. This would not work from applets would it? -- Trent Jarvi taj at www.linux.org.uk ---------- Forwarded message ---------- Date: Thu, 07 Apr 2005 16:05:53 -0400 From: Chris Gaffney To: taj at www.linux.org.uk Subject: RXTX Libraries on Classpath fix Hi, I submitted a patch for RXTX a few weeks ago to allow for loading the native libraries from the classpath. Since sending it to you I found it wasn't working on windows. I've fixed the problem and created a new patch that should replace the older one. The actual change is a one line from a String.equals() to a String.startsWith(). Thanks for a great piece of software, -Chris Gaffney Grand Valley State University -------------- next part -------------- A non-text attachment was scrubbed... Name: libraries_on_classpath_fixed.patch Type: text/x-patch Size: 5617 bytes Desc: Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5d423b8/libraries_on_classpath_fixed-0047.bin From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From thomas.shulok at lmco.com Fri Apr 8 10:38:55 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Fri, 08 Apr 2005 12:38:55 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi Trent, Thanks for the prompt response. Before diving deeper, I was wondering if there is a timeout parameter somewhere in the stack that I have not set properly. Given the nature of the failure (only fails if the line has been idle for a few seconds), it feels like some kind of timeout issue... Thanks again, Thom -----Original Message----- From: rxtx-bounces at mail.linuxgrrls.org [mailto:rxtx-bounces at mail.linuxgrrls.org] On Behalf Of Trent Jarvi Sent: Thursday, April 07, 2005 6:23 PM To: Java RXTX discussion Subject: Re: [Rxtx] Input/output error in writeArray On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a > Windows box. Everything connects up fine, and I can send and receive > a simple sequence of bytes with no problems. However, if around 5 > seconds goes by without me sending something, I get the following when > I attempt to send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at mail.linuxgrrls.org http://mail.linuxgrrls.org/mailman/listinfo/rxtx From ricardo.trindade at emation.pt Mon Apr 4 09:17:23 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Mon, 04 Apr 2005 16:17:23 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot Message-ID: <42515A83.4050907@emation.pt> Hi, I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most recent stable snapshot), and get the following exception : It looks like rxtx has been compiled with jdk 1.5. If this was indeed the case, I think there is a compilation flag that generates code that runs on older jdks. java.lang.UnsupportedClassVersionError: gnu/io/UnsupportedCommOperationException (Unsupported major.minor version 49.0) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at java.net.URLClassLoader.defineClass(URLClassLoader.java:251) at java.net.URLClassLoader.access$100(URLClassLoader.java:55) at java.net.URLClassLoader$1.run(URLClassLoader.java:194) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:187) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:141) I'm trying to run it with 1.4. thanks Ricardo From taj at www.linux.org.uk Tue Apr 5 00:48:12 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 07:48:12 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42515A83.4050907@emation.pt> References: <42515A83.4050907@emation.pt> Message-ID: On Mon, 4 Apr 2005, Ricardo Trindade wrote: > Hi, > > I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most > recent stable snapshot), and get the following exception : > > It looks like rxtx has been compiled with jdk 1.5. If this was > indeed the case, I think there is a compilation flag that generates code > that runs on older jdks. > > java.lang.UnsupportedClassVersionError: > gnu/io/UnsupportedCommOperationException (Unsupported major.minor > version 49.0) [snip] Thanks Ricardo I recompiled the jar with javac -source 1.3 -target 1.3. That should cover most of the JRE's in use today. I also compiled the rxtx 2.0 x86_64 native library which appeared to be missing. I tried looking for flags to pass gcc 4.0 to make the native libraries more backwards compatible but only found options for C++ which is not used in rxtx. I've got a list of other bugs that I'll be going through in the next few weeks but for now I just left them with the same CVS filename - no code changes. ftp://ftp.qbang.org/pub/rxtx/rxtx-2.0-CVS-20050120-bins.tar.gz ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-CVS-20050120-bins.tar.gz -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Tue Apr 5 02:24:33 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 05 Apr 2005 09:24:33 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: References: <42515A83.4050907@emation.pt> Message-ID: <42524B41.3040300@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050405/5919abbb/attachment-0048.html From taj at www.linux.org.uk Tue Apr 5 03:00:29 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 10:00:29 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42524B41.3040300@emation.pt> References: <42515A83.4050907@emation.pt> <42524B41.3040300@emation.pt> Message-ID: On Tue, 5 Apr 2005, Ricardo Trindade wrote: > Will you anounce to the list when a new release is available ? > There will be several incremental releases announced here. Once those are done, we will release 2.1.7 and 2.0.7. -- Trent Jarvi taj at www.linux.org.uk From no_spam at somewhere.com Tue Apr 5 11:55:37 2005 From: no_spam at somewhere.com (no_spam@somewhere.com) Date: Tue, 5 Apr 2005 13:55:37 -0400 Subject: [Rxtx] Closing a port from an event listener results in a deadlock Message-ID: <20050405175537.GA21747@rcog.homelinux.net> On the message I sent on March 14, does anyone had the chance to try the modification? Or was it already fixed? (I haven't searched the archive extensively) Or maybe my message got catched by some spam filters? (it made it to the list archive though) Anyway, I would appreciate some feedback (through the list) Thanks From taj at www.linux.org.uk Tue Apr 5 14:42:28 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 21:42:28 +0100 (BST) Subject: [Rxtx] Closing a port from an event listener results in a deadlock In-Reply-To: <20050405175537.GA21747@rcog.homelinux.net> References: <20050405175537.GA21747@rcog.homelinux.net> Message-ID: On Tue, 5 Apr 2005 no_spam at somewhere.com wrote: > On the message I sent on March 14, does anyone had the chance to try the > modification? > > Or was it already fixed? (I haven't searched the archive extensively) > > Or maybe my message got catched by some spam filters? (it made it to the list > archive though) > > Anyway, I would appreciate some feedback (through the list) > The patch is here http://marc.theaimsgroup.com/?l=rxtx&m=111084488820288&w=2 I have applied this patch to a local copy but will not be doing formal testing for a couple weeks. I do not try to close ports from inside the eventListenter usually so I encourage any feedback also. If there are no problems reported, I expect this will go into rxtx 2.1-7. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Wed Apr 6 08:33:42 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Wed, 06 Apr 2005 15:33:42 +0100 Subject: [Rxtx] getting RXTX version Message-ID: <4253F346.50102@emation.pt> Hi, I want to make sure my deployments have the same version of RXTX jar and native lib. I know the version of the jar can be obtained in the Version class, but how can I obtain the native version ? I know RXTX prints to the console a warning if the version is different. Is there a way to programatically know is this is the case ? I would like to log that to our app's log thanks Ricardo From taj at www.linux.org.uk Wed Apr 6 15:10:20 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 6 Apr 2005 22:10:20 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4253F346.50102@emation.pt> References: <4253F346.50102@emation.pt> Message-ID: On Wed, 6 Apr 2005, Ricardo Trindade wrote: > Hi, > > I want to make sure my deployments have the same version of RXTX jar > and native lib. > > I know the version of the jar can be obtained in the Version class, > but how can I obtain the native version ? > > I know RXTX prints to the console a warning if the version is > different. Is there a way to programatically know is this is the case ? > > I would like to log that to our app's log > There isn't a suggested way of doing that right now. We could move things around and have a static String RXTXVersion.getNativeVersion() in future releases. Is this what you expected? This is not documented in commapi at all. I just tossed that in to catch conflicts while developing. It would be nice to have access in GUI applications though. It may be possible to access RXTXCommDriver.LibVersion right now. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Thu Apr 7 02:51:00 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 09:51:00 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> Message-ID: <4254F474.7020905@emation.pt> >There isn't a suggested way of doing that right now. We could move things >around and have a static String RXTXVersion.getNativeVersion() in future >releases. Is this what you expected? > > Yes, that would be perfect. >This is not documented in commapi at all. I just tossed that in to catch >conflicts while developing. It would be nice to have access in GUI >applications though. > >It may be possible to access RXTXCommDriver.LibVersion right now. > > > I tried, and I don't think it's possible. From taj at www.linux.org.uk Thu Apr 7 03:32:04 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 7 Apr 2005 10:32:04 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4254F474.7020905@emation.pt> References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: On Thu, 7 Apr 2005, Ricardo Trindade wrote: > > >There isn't a suggested way of doing that right now. We could move things > >around and have a static String RXTXVersion.getNativeVersion() in future > >releases. Is this what you expected? > > > > > > Yes, that would be perfect. > The attached should do what you want. You will still need to catch an exception for older versions... -- Trent Jarvi taj at www.linux.org.uk -------------- next part -------------- ? public_version.patch Index: RXTXCommDriver.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXCommDriver.java,v retrieving revision 1.16.2.51 diff -u -r1.16.2.51 RXTXCommDriver.java --- RXTXCommDriver.java 12 Oct 2004 09:13:30 -0000 1.16.2.51 +++ RXTXCommDriver.java 7 Apr 2005 09:29:04 -0000 @@ -54,7 +54,7 @@ the Library. */ String JarVersion = RXTXVersion.getVersion(); - String LibVersion = nativeGetVersion(); + String LibVersion = RXTXVersion.nativeGetVersion(); if ( devel ) { System.out.println("Devel Library"); @@ -76,7 +76,6 @@ /** Get the Serial port prefixes for the running OS */ private String deviceDirectory; private String osName; - private static native String nativeGetVersion(); private native boolean registerKnownPorts(int PortType); private native boolean isPortPrefixValid(String dev); private native boolean testRead(String dev, int type); Index: RXTXVersion.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXVersion.java,v retrieving revision 1.2.2.31 diff -u -r1.2.2.31 RXTXVersion.java --- RXTXVersion.java 16 Oct 2004 16:20:35 -0000 1.2.2.31 +++ RXTXVersion.java 7 Apr 2005 09:29:04 -0000 @@ -36,6 +36,7 @@ private static String Version; static { + System.loadLibrary( "rxtxSerial" ); Version = "RXTX-2.1-7pre20"; } /** @@ -47,4 +48,5 @@ { return(Version); } + public static native String nativeGetVersion(); } Index: SerialImp.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v retrieving revision 1.46.2.181 diff -u -r1.46.2.181 SerialImp.c --- SerialImp.c 17 Oct 2004 09:48:56 -0000 1.46.2.181 +++ SerialImp.c 7 Apr 2005 09:29:07 -0000 @@ -116,6 +116,7 @@ * It will eventually be removed. * */ #define RXTXPort(foo) Java_gnu_io_RXTXPort_ ## foo +#define RXTXVersion(foo) Java_gnu_io_RXTXVersion_ ## foo #define RXTXCommDriver(foo) Java_gnu_io_RXTXCommDriver_ ## foo #if defined(__sun__) || defined(__hpux__) @@ -4001,7 +4002,7 @@ } /*---------------------------------------------------------- -RXTXCommDriver.nativeGetVersion +RXTXVersion.nativeGetVersion accept: none perform: return the current version @@ -4010,9 +4011,10 @@ comments: This is used to avoid mixing versions of the .jar and native library. First introduced in rxtx-1.5-9 + Moved from RXTXCommDriver to RXTXVersion in rxtx-2.1-7 ----------------------------------------------------------*/ -JNIEXPORT jstring JNICALL RXTXCommDriver(nativeGetVersion) (JNIEnv *env, +JNIEXPORT jstring JNICALL RXTXVersion(nativeGetVersion) (JNIEnv *env, jclass jclazz ) { return (*env)->NewStringUTF( env, "RXTX-2.1-7pre20" ); From ricardo.trindade at emation.pt Thu Apr 7 03:45:58 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 10:45:58 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: <42550156.2040908@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050407/05212451/attachment-0048.html From thomas.shulok at lmco.com Thu Apr 7 17:43:11 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Thu, 07 Apr 2005 19:43:11 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi There, I'm attempting to talk RS232 between an embedded Linux box and a Windows box. Everything connects up fine, and I can send and receive a simple sequence of bytes with no problems. However, if around 5 seconds goes by without me sending something, I get the following when I attempt to send. java.io.IOException: Input/output error in writeArray Stack trace: java/lang/Throwable.()V java/lang/Throwable.(Ljava/lang/String;)V java/io/IOException.(Ljava/lang/String;)V gnu/io/RXTXPort.writeArray([BIIZ)V gnu/io/RXTXPort$SerialOutputStream.write([B)V SerialTest.main([Ljava/lang/String;)V If there interval is shorter (say 2 seconds between sends), I have no problems. On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and librxtxSerial-2.0.7pre2.so. Any ideas? Thanks, Thom -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5b23dcf/attachment-0048.html From taj at www.linux.org.uk Thu Apr 7 19:22:36 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:22:36 +0100 (BST) Subject: [Rxtx] Input/output error in writeArray In-Reply-To: References: Message-ID: On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a Windows > box. Everything connects up fine, and I can send and receive a simple > sequence of bytes with no problems. However, if around 5 seconds goes > by without me sending something, I get the following when I attempt to > send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Apr 7 19:24:59 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:24:59 +0100 (BST) Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) Message-ID: hmm. This would not work from applets would it? -- Trent Jarvi taj at www.linux.org.uk ---------- Forwarded message ---------- Date: Thu, 07 Apr 2005 16:05:53 -0400 From: Chris Gaffney To: taj at www.linux.org.uk Subject: RXTX Libraries on Classpath fix Hi, I submitted a patch for RXTX a few weeks ago to allow for loading the native libraries from the classpath. Since sending it to you I found it wasn't working on windows. I've fixed the problem and created a new patch that should replace the older one. The actual change is a one line from a String.equals() to a String.startsWith(). Thanks for a great piece of software, -Chris Gaffney Grand Valley State University -------------- next part -------------- A non-text attachment was scrubbed... Name: libraries_on_classpath_fixed.patch Type: text/x-patch Size: 5617 bytes Desc: Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5d423b8/libraries_on_classpath_fixed-0048.bin From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From thomas.shulok at lmco.com Fri Apr 8 10:38:55 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Fri, 08 Apr 2005 12:38:55 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi Trent, Thanks for the prompt response. Before diving deeper, I was wondering if there is a timeout parameter somewhere in the stack that I have not set properly. Given the nature of the failure (only fails if the line has been idle for a few seconds), it feels like some kind of timeout issue... Thanks again, Thom -----Original Message----- From: rxtx-bounces at mail.linuxgrrls.org [mailto:rxtx-bounces at mail.linuxgrrls.org] On Behalf Of Trent Jarvi Sent: Thursday, April 07, 2005 6:23 PM To: Java RXTX discussion Subject: Re: [Rxtx] Input/output error in writeArray On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a > Windows box. Everything connects up fine, and I can send and receive > a simple sequence of bytes with no problems. However, if around 5 > seconds goes by without me sending something, I get the following when > I attempt to send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at mail.linuxgrrls.org http://mail.linuxgrrls.org/mailman/listinfo/rxtx From ricardo.trindade at emation.pt Mon Apr 4 09:17:23 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Mon, 04 Apr 2005 16:17:23 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot Message-ID: <42515A83.4050907@emation.pt> Hi, I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most recent stable snapshot), and get the following exception : It looks like rxtx has been compiled with jdk 1.5. If this was indeed the case, I think there is a compilation flag that generates code that runs on older jdks. java.lang.UnsupportedClassVersionError: gnu/io/UnsupportedCommOperationException (Unsupported major.minor version 49.0) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at java.net.URLClassLoader.defineClass(URLClassLoader.java:251) at java.net.URLClassLoader.access$100(URLClassLoader.java:55) at java.net.URLClassLoader$1.run(URLClassLoader.java:194) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:187) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:141) I'm trying to run it with 1.4. thanks Ricardo From taj at www.linux.org.uk Tue Apr 5 00:48:12 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 07:48:12 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42515A83.4050907@emation.pt> References: <42515A83.4050907@emation.pt> Message-ID: On Mon, 4 Apr 2005, Ricardo Trindade wrote: > Hi, > > I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most > recent stable snapshot), and get the following exception : > > It looks like rxtx has been compiled with jdk 1.5. If this was > indeed the case, I think there is a compilation flag that generates code > that runs on older jdks. > > java.lang.UnsupportedClassVersionError: > gnu/io/UnsupportedCommOperationException (Unsupported major.minor > version 49.0) [snip] Thanks Ricardo I recompiled the jar with javac -source 1.3 -target 1.3. That should cover most of the JRE's in use today. I also compiled the rxtx 2.0 x86_64 native library which appeared to be missing. I tried looking for flags to pass gcc 4.0 to make the native libraries more backwards compatible but only found options for C++ which is not used in rxtx. I've got a list of other bugs that I'll be going through in the next few weeks but for now I just left them with the same CVS filename - no code changes. ftp://ftp.qbang.org/pub/rxtx/rxtx-2.0-CVS-20050120-bins.tar.gz ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-CVS-20050120-bins.tar.gz -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Tue Apr 5 02:24:33 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 05 Apr 2005 09:24:33 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: References: <42515A83.4050907@emation.pt> Message-ID: <42524B41.3040300@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050405/5919abbb/attachment-0049.html From taj at www.linux.org.uk Tue Apr 5 03:00:29 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 10:00:29 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42524B41.3040300@emation.pt> References: <42515A83.4050907@emation.pt> <42524B41.3040300@emation.pt> Message-ID: On Tue, 5 Apr 2005, Ricardo Trindade wrote: > Will you anounce to the list when a new release is available ? > There will be several incremental releases announced here. Once those are done, we will release 2.1.7 and 2.0.7. -- Trent Jarvi taj at www.linux.org.uk From no_spam at somewhere.com Tue Apr 5 11:55:37 2005 From: no_spam at somewhere.com (no_spam@somewhere.com) Date: Tue, 5 Apr 2005 13:55:37 -0400 Subject: [Rxtx] Closing a port from an event listener results in a deadlock Message-ID: <20050405175537.GA21747@rcog.homelinux.net> On the message I sent on March 14, does anyone had the chance to try the modification? Or was it already fixed? (I haven't searched the archive extensively) Or maybe my message got catched by some spam filters? (it made it to the list archive though) Anyway, I would appreciate some feedback (through the list) Thanks From taj at www.linux.org.uk Tue Apr 5 14:42:28 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 21:42:28 +0100 (BST) Subject: [Rxtx] Closing a port from an event listener results in a deadlock In-Reply-To: <20050405175537.GA21747@rcog.homelinux.net> References: <20050405175537.GA21747@rcog.homelinux.net> Message-ID: On Tue, 5 Apr 2005 no_spam at somewhere.com wrote: > On the message I sent on March 14, does anyone had the chance to try the > modification? > > Or was it already fixed? (I haven't searched the archive extensively) > > Or maybe my message got catched by some spam filters? (it made it to the list > archive though) > > Anyway, I would appreciate some feedback (through the list) > The patch is here http://marc.theaimsgroup.com/?l=rxtx&m=111084488820288&w=2 I have applied this patch to a local copy but will not be doing formal testing for a couple weeks. I do not try to close ports from inside the eventListenter usually so I encourage any feedback also. If there are no problems reported, I expect this will go into rxtx 2.1-7. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Wed Apr 6 08:33:42 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Wed, 06 Apr 2005 15:33:42 +0100 Subject: [Rxtx] getting RXTX version Message-ID: <4253F346.50102@emation.pt> Hi, I want to make sure my deployments have the same version of RXTX jar and native lib. I know the version of the jar can be obtained in the Version class, but how can I obtain the native version ? I know RXTX prints to the console a warning if the version is different. Is there a way to programatically know is this is the case ? I would like to log that to our app's log thanks Ricardo From taj at www.linux.org.uk Wed Apr 6 15:10:20 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 6 Apr 2005 22:10:20 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4253F346.50102@emation.pt> References: <4253F346.50102@emation.pt> Message-ID: On Wed, 6 Apr 2005, Ricardo Trindade wrote: > Hi, > > I want to make sure my deployments have the same version of RXTX jar > and native lib. > > I know the version of the jar can be obtained in the Version class, > but how can I obtain the native version ? > > I know RXTX prints to the console a warning if the version is > different. Is there a way to programatically know is this is the case ? > > I would like to log that to our app's log > There isn't a suggested way of doing that right now. We could move things around and have a static String RXTXVersion.getNativeVersion() in future releases. Is this what you expected? This is not documented in commapi at all. I just tossed that in to catch conflicts while developing. It would be nice to have access in GUI applications though. It may be possible to access RXTXCommDriver.LibVersion right now. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Thu Apr 7 02:51:00 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 09:51:00 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> Message-ID: <4254F474.7020905@emation.pt> >There isn't a suggested way of doing that right now. We could move things >around and have a static String RXTXVersion.getNativeVersion() in future >releases. Is this what you expected? > > Yes, that would be perfect. >This is not documented in commapi at all. I just tossed that in to catch >conflicts while developing. It would be nice to have access in GUI >applications though. > >It may be possible to access RXTXCommDriver.LibVersion right now. > > > I tried, and I don't think it's possible. From taj at www.linux.org.uk Thu Apr 7 03:32:04 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 7 Apr 2005 10:32:04 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4254F474.7020905@emation.pt> References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: On Thu, 7 Apr 2005, Ricardo Trindade wrote: > > >There isn't a suggested way of doing that right now. We could move things > >around and have a static String RXTXVersion.getNativeVersion() in future > >releases. Is this what you expected? > > > > > > Yes, that would be perfect. > The attached should do what you want. You will still need to catch an exception for older versions... -- Trent Jarvi taj at www.linux.org.uk -------------- next part -------------- ? public_version.patch Index: RXTXCommDriver.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXCommDriver.java,v retrieving revision 1.16.2.51 diff -u -r1.16.2.51 RXTXCommDriver.java --- RXTXCommDriver.java 12 Oct 2004 09:13:30 -0000 1.16.2.51 +++ RXTXCommDriver.java 7 Apr 2005 09:29:04 -0000 @@ -54,7 +54,7 @@ the Library. */ String JarVersion = RXTXVersion.getVersion(); - String LibVersion = nativeGetVersion(); + String LibVersion = RXTXVersion.nativeGetVersion(); if ( devel ) { System.out.println("Devel Library"); @@ -76,7 +76,6 @@ /** Get the Serial port prefixes for the running OS */ private String deviceDirectory; private String osName; - private static native String nativeGetVersion(); private native boolean registerKnownPorts(int PortType); private native boolean isPortPrefixValid(String dev); private native boolean testRead(String dev, int type); Index: RXTXVersion.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXVersion.java,v retrieving revision 1.2.2.31 diff -u -r1.2.2.31 RXTXVersion.java --- RXTXVersion.java 16 Oct 2004 16:20:35 -0000 1.2.2.31 +++ RXTXVersion.java 7 Apr 2005 09:29:04 -0000 @@ -36,6 +36,7 @@ private static String Version; static { + System.loadLibrary( "rxtxSerial" ); Version = "RXTX-2.1-7pre20"; } /** @@ -47,4 +48,5 @@ { return(Version); } + public static native String nativeGetVersion(); } Index: SerialImp.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v retrieving revision 1.46.2.181 diff -u -r1.46.2.181 SerialImp.c --- SerialImp.c 17 Oct 2004 09:48:56 -0000 1.46.2.181 +++ SerialImp.c 7 Apr 2005 09:29:07 -0000 @@ -116,6 +116,7 @@ * It will eventually be removed. * */ #define RXTXPort(foo) Java_gnu_io_RXTXPort_ ## foo +#define RXTXVersion(foo) Java_gnu_io_RXTXVersion_ ## foo #define RXTXCommDriver(foo) Java_gnu_io_RXTXCommDriver_ ## foo #if defined(__sun__) || defined(__hpux__) @@ -4001,7 +4002,7 @@ } /*---------------------------------------------------------- -RXTXCommDriver.nativeGetVersion +RXTXVersion.nativeGetVersion accept: none perform: return the current version @@ -4010,9 +4011,10 @@ comments: This is used to avoid mixing versions of the .jar and native library. First introduced in rxtx-1.5-9 + Moved from RXTXCommDriver to RXTXVersion in rxtx-2.1-7 ----------------------------------------------------------*/ -JNIEXPORT jstring JNICALL RXTXCommDriver(nativeGetVersion) (JNIEnv *env, +JNIEXPORT jstring JNICALL RXTXVersion(nativeGetVersion) (JNIEnv *env, jclass jclazz ) { return (*env)->NewStringUTF( env, "RXTX-2.1-7pre20" ); From ricardo.trindade at emation.pt Thu Apr 7 03:45:58 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 10:45:58 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: <42550156.2040908@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050407/05212451/attachment-0049.html From thomas.shulok at lmco.com Thu Apr 7 17:43:11 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Thu, 07 Apr 2005 19:43:11 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi There, I'm attempting to talk RS232 between an embedded Linux box and a Windows box. Everything connects up fine, and I can send and receive a simple sequence of bytes with no problems. However, if around 5 seconds goes by without me sending something, I get the following when I attempt to send. java.io.IOException: Input/output error in writeArray Stack trace: java/lang/Throwable.()V java/lang/Throwable.(Ljava/lang/String;)V java/io/IOException.(Ljava/lang/String;)V gnu/io/RXTXPort.writeArray([BIIZ)V gnu/io/RXTXPort$SerialOutputStream.write([B)V SerialTest.main([Ljava/lang/String;)V If there interval is shorter (say 2 seconds between sends), I have no problems. On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and librxtxSerial-2.0.7pre2.so. Any ideas? Thanks, Thom -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5b23dcf/attachment-0049.html From taj at www.linux.org.uk Thu Apr 7 19:22:36 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:22:36 +0100 (BST) Subject: [Rxtx] Input/output error in writeArray In-Reply-To: References: Message-ID: On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a Windows > box. Everything connects up fine, and I can send and receive a simple > sequence of bytes with no problems. However, if around 5 seconds goes > by without me sending something, I get the following when I attempt to > send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Apr 7 19:24:59 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:24:59 +0100 (BST) Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) Message-ID: hmm. This would not work from applets would it? -- Trent Jarvi taj at www.linux.org.uk ---------- Forwarded message ---------- Date: Thu, 07 Apr 2005 16:05:53 -0400 From: Chris Gaffney To: taj at www.linux.org.uk Subject: RXTX Libraries on Classpath fix Hi, I submitted a patch for RXTX a few weeks ago to allow for loading the native libraries from the classpath. Since sending it to you I found it wasn't working on windows. I've fixed the problem and created a new patch that should replace the older one. The actual change is a one line from a String.equals() to a String.startsWith(). Thanks for a great piece of software, -Chris Gaffney Grand Valley State University -------------- next part -------------- A non-text attachment was scrubbed... Name: libraries_on_classpath_fixed.patch Type: text/x-patch Size: 5617 bytes Desc: Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5d423b8/libraries_on_classpath_fixed-0049.bin From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From thomas.shulok at lmco.com Fri Apr 8 10:38:55 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Fri, 08 Apr 2005 12:38:55 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi Trent, Thanks for the prompt response. Before diving deeper, I was wondering if there is a timeout parameter somewhere in the stack that I have not set properly. Given the nature of the failure (only fails if the line has been idle for a few seconds), it feels like some kind of timeout issue... Thanks again, Thom -----Original Message----- From: rxtx-bounces at mail.linuxgrrls.org [mailto:rxtx-bounces at mail.linuxgrrls.org] On Behalf Of Trent Jarvi Sent: Thursday, April 07, 2005 6:23 PM To: Java RXTX discussion Subject: Re: [Rxtx] Input/output error in writeArray On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a > Windows box. Everything connects up fine, and I can send and receive > a simple sequence of bytes with no problems. However, if around 5 > seconds goes by without me sending something, I get the following when > I attempt to send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at mail.linuxgrrls.org http://mail.linuxgrrls.org/mailman/listinfo/rxtx From ricardo.trindade at emation.pt Mon Apr 4 09:17:23 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Mon, 04 Apr 2005 16:17:23 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot Message-ID: <42515A83.4050907@emation.pt> Hi, I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most recent stable snapshot), and get the following exception : It looks like rxtx has been compiled with jdk 1.5. If this was indeed the case, I think there is a compilation flag that generates code that runs on older jdks. java.lang.UnsupportedClassVersionError: gnu/io/UnsupportedCommOperationException (Unsupported major.minor version 49.0) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at java.net.URLClassLoader.defineClass(URLClassLoader.java:251) at java.net.URLClassLoader.access$100(URLClassLoader.java:55) at java.net.URLClassLoader$1.run(URLClassLoader.java:194) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:187) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:141) I'm trying to run it with 1.4. thanks Ricardo From taj at www.linux.org.uk Tue Apr 5 00:48:12 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 07:48:12 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42515A83.4050907@emation.pt> References: <42515A83.4050907@emation.pt> Message-ID: On Mon, 4 Apr 2005, Ricardo Trindade wrote: > Hi, > > I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most > recent stable snapshot), and get the following exception : > > It looks like rxtx has been compiled with jdk 1.5. If this was > indeed the case, I think there is a compilation flag that generates code > that runs on older jdks. > > java.lang.UnsupportedClassVersionError: > gnu/io/UnsupportedCommOperationException (Unsupported major.minor > version 49.0) [snip] Thanks Ricardo I recompiled the jar with javac -source 1.3 -target 1.3. That should cover most of the JRE's in use today. I also compiled the rxtx 2.0 x86_64 native library which appeared to be missing. I tried looking for flags to pass gcc 4.0 to make the native libraries more backwards compatible but only found options for C++ which is not used in rxtx. I've got a list of other bugs that I'll be going through in the next few weeks but for now I just left them with the same CVS filename - no code changes. ftp://ftp.qbang.org/pub/rxtx/rxtx-2.0-CVS-20050120-bins.tar.gz ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-CVS-20050120-bins.tar.gz -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Tue Apr 5 02:24:33 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 05 Apr 2005 09:24:33 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: References: <42515A83.4050907@emation.pt> Message-ID: <42524B41.3040300@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050405/5919abbb/attachment-0050.html From taj at www.linux.org.uk Tue Apr 5 03:00:29 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 10:00:29 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42524B41.3040300@emation.pt> References: <42515A83.4050907@emation.pt> <42524B41.3040300@emation.pt> Message-ID: On Tue, 5 Apr 2005, Ricardo Trindade wrote: > Will you anounce to the list when a new release is available ? > There will be several incremental releases announced here. Once those are done, we will release 2.1.7 and 2.0.7. -- Trent Jarvi taj at www.linux.org.uk From no_spam at somewhere.com Tue Apr 5 11:55:37 2005 From: no_spam at somewhere.com (no_spam@somewhere.com) Date: Tue, 5 Apr 2005 13:55:37 -0400 Subject: [Rxtx] Closing a port from an event listener results in a deadlock Message-ID: <20050405175537.GA21747@rcog.homelinux.net> On the message I sent on March 14, does anyone had the chance to try the modification? Or was it already fixed? (I haven't searched the archive extensively) Or maybe my message got catched by some spam filters? (it made it to the list archive though) Anyway, I would appreciate some feedback (through the list) Thanks From taj at www.linux.org.uk Tue Apr 5 14:42:28 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 21:42:28 +0100 (BST) Subject: [Rxtx] Closing a port from an event listener results in a deadlock In-Reply-To: <20050405175537.GA21747@rcog.homelinux.net> References: <20050405175537.GA21747@rcog.homelinux.net> Message-ID: On Tue, 5 Apr 2005 no_spam at somewhere.com wrote: > On the message I sent on March 14, does anyone had the chance to try the > modification? > > Or was it already fixed? (I haven't searched the archive extensively) > > Or maybe my message got catched by some spam filters? (it made it to the list > archive though) > > Anyway, I would appreciate some feedback (through the list) > The patch is here http://marc.theaimsgroup.com/?l=rxtx&m=111084488820288&w=2 I have applied this patch to a local copy but will not be doing formal testing for a couple weeks. I do not try to close ports from inside the eventListenter usually so I encourage any feedback also. If there are no problems reported, I expect this will go into rxtx 2.1-7. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Wed Apr 6 08:33:42 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Wed, 06 Apr 2005 15:33:42 +0100 Subject: [Rxtx] getting RXTX version Message-ID: <4253F346.50102@emation.pt> Hi, I want to make sure my deployments have the same version of RXTX jar and native lib. I know the version of the jar can be obtained in the Version class, but how can I obtain the native version ? I know RXTX prints to the console a warning if the version is different. Is there a way to programatically know is this is the case ? I would like to log that to our app's log thanks Ricardo From taj at www.linux.org.uk Wed Apr 6 15:10:20 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 6 Apr 2005 22:10:20 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4253F346.50102@emation.pt> References: <4253F346.50102@emation.pt> Message-ID: On Wed, 6 Apr 2005, Ricardo Trindade wrote: > Hi, > > I want to make sure my deployments have the same version of RXTX jar > and native lib. > > I know the version of the jar can be obtained in the Version class, > but how can I obtain the native version ? > > I know RXTX prints to the console a warning if the version is > different. Is there a way to programatically know is this is the case ? > > I would like to log that to our app's log > There isn't a suggested way of doing that right now. We could move things around and have a static String RXTXVersion.getNativeVersion() in future releases. Is this what you expected? This is not documented in commapi at all. I just tossed that in to catch conflicts while developing. It would be nice to have access in GUI applications though. It may be possible to access RXTXCommDriver.LibVersion right now. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Thu Apr 7 02:51:00 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 09:51:00 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> Message-ID: <4254F474.7020905@emation.pt> >There isn't a suggested way of doing that right now. We could move things >around and have a static String RXTXVersion.getNativeVersion() in future >releases. Is this what you expected? > > Yes, that would be perfect. >This is not documented in commapi at all. I just tossed that in to catch >conflicts while developing. It would be nice to have access in GUI >applications though. > >It may be possible to access RXTXCommDriver.LibVersion right now. > > > I tried, and I don't think it's possible. From taj at www.linux.org.uk Thu Apr 7 03:32:04 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 7 Apr 2005 10:32:04 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4254F474.7020905@emation.pt> References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: On Thu, 7 Apr 2005, Ricardo Trindade wrote: > > >There isn't a suggested way of doing that right now. We could move things > >around and have a static String RXTXVersion.getNativeVersion() in future > >releases. Is this what you expected? > > > > > > Yes, that would be perfect. > The attached should do what you want. You will still need to catch an exception for older versions... -- Trent Jarvi taj at www.linux.org.uk -------------- next part -------------- ? public_version.patch Index: RXTXCommDriver.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXCommDriver.java,v retrieving revision 1.16.2.51 diff -u -r1.16.2.51 RXTXCommDriver.java --- RXTXCommDriver.java 12 Oct 2004 09:13:30 -0000 1.16.2.51 +++ RXTXCommDriver.java 7 Apr 2005 09:29:04 -0000 @@ -54,7 +54,7 @@ the Library. */ String JarVersion = RXTXVersion.getVersion(); - String LibVersion = nativeGetVersion(); + String LibVersion = RXTXVersion.nativeGetVersion(); if ( devel ) { System.out.println("Devel Library"); @@ -76,7 +76,6 @@ /** Get the Serial port prefixes for the running OS */ private String deviceDirectory; private String osName; - private static native String nativeGetVersion(); private native boolean registerKnownPorts(int PortType); private native boolean isPortPrefixValid(String dev); private native boolean testRead(String dev, int type); Index: RXTXVersion.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXVersion.java,v retrieving revision 1.2.2.31 diff -u -r1.2.2.31 RXTXVersion.java --- RXTXVersion.java 16 Oct 2004 16:20:35 -0000 1.2.2.31 +++ RXTXVersion.java 7 Apr 2005 09:29:04 -0000 @@ -36,6 +36,7 @@ private static String Version; static { + System.loadLibrary( "rxtxSerial" ); Version = "RXTX-2.1-7pre20"; } /** @@ -47,4 +48,5 @@ { return(Version); } + public static native String nativeGetVersion(); } Index: SerialImp.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v retrieving revision 1.46.2.181 diff -u -r1.46.2.181 SerialImp.c --- SerialImp.c 17 Oct 2004 09:48:56 -0000 1.46.2.181 +++ SerialImp.c 7 Apr 2005 09:29:07 -0000 @@ -116,6 +116,7 @@ * It will eventually be removed. * */ #define RXTXPort(foo) Java_gnu_io_RXTXPort_ ## foo +#define RXTXVersion(foo) Java_gnu_io_RXTXVersion_ ## foo #define RXTXCommDriver(foo) Java_gnu_io_RXTXCommDriver_ ## foo #if defined(__sun__) || defined(__hpux__) @@ -4001,7 +4002,7 @@ } /*---------------------------------------------------------- -RXTXCommDriver.nativeGetVersion +RXTXVersion.nativeGetVersion accept: none perform: return the current version @@ -4010,9 +4011,10 @@ comments: This is used to avoid mixing versions of the .jar and native library. First introduced in rxtx-1.5-9 + Moved from RXTXCommDriver to RXTXVersion in rxtx-2.1-7 ----------------------------------------------------------*/ -JNIEXPORT jstring JNICALL RXTXCommDriver(nativeGetVersion) (JNIEnv *env, +JNIEXPORT jstring JNICALL RXTXVersion(nativeGetVersion) (JNIEnv *env, jclass jclazz ) { return (*env)->NewStringUTF( env, "RXTX-2.1-7pre20" ); From ricardo.trindade at emation.pt Thu Apr 7 03:45:58 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 10:45:58 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: <42550156.2040908@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050407/05212451/attachment-0050.html From thomas.shulok at lmco.com Thu Apr 7 17:43:11 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Thu, 07 Apr 2005 19:43:11 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi There, I'm attempting to talk RS232 between an embedded Linux box and a Windows box. Everything connects up fine, and I can send and receive a simple sequence of bytes with no problems. However, if around 5 seconds goes by without me sending something, I get the following when I attempt to send. java.io.IOException: Input/output error in writeArray Stack trace: java/lang/Throwable.()V java/lang/Throwable.(Ljava/lang/String;)V java/io/IOException.(Ljava/lang/String;)V gnu/io/RXTXPort.writeArray([BIIZ)V gnu/io/RXTXPort$SerialOutputStream.write([B)V SerialTest.main([Ljava/lang/String;)V If there interval is shorter (say 2 seconds between sends), I have no problems. On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and librxtxSerial-2.0.7pre2.so. Any ideas? Thanks, Thom -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5b23dcf/attachment-0050.html From taj at www.linux.org.uk Thu Apr 7 19:22:36 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:22:36 +0100 (BST) Subject: [Rxtx] Input/output error in writeArray In-Reply-To: References: Message-ID: On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a Windows > box. Everything connects up fine, and I can send and receive a simple > sequence of bytes with no problems. However, if around 5 seconds goes > by without me sending something, I get the following when I attempt to > send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Apr 7 19:24:59 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:24:59 +0100 (BST) Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) Message-ID: hmm. This would not work from applets would it? -- Trent Jarvi taj at www.linux.org.uk ---------- Forwarded message ---------- Date: Thu, 07 Apr 2005 16:05:53 -0400 From: Chris Gaffney To: taj at www.linux.org.uk Subject: RXTX Libraries on Classpath fix Hi, I submitted a patch for RXTX a few weeks ago to allow for loading the native libraries from the classpath. Since sending it to you I found it wasn't working on windows. I've fixed the problem and created a new patch that should replace the older one. The actual change is a one line from a String.equals() to a String.startsWith(). Thanks for a great piece of software, -Chris Gaffney Grand Valley State University -------------- next part -------------- A non-text attachment was scrubbed... Name: libraries_on_classpath_fixed.patch Type: text/x-patch Size: 5617 bytes Desc: Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5d423b8/libraries_on_classpath_fixed-0050.bin From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From thomas.shulok at lmco.com Fri Apr 8 10:38:55 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Fri, 08 Apr 2005 12:38:55 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi Trent, Thanks for the prompt response. Before diving deeper, I was wondering if there is a timeout parameter somewhere in the stack that I have not set properly. Given the nature of the failure (only fails if the line has been idle for a few seconds), it feels like some kind of timeout issue... Thanks again, Thom -----Original Message----- From: rxtx-bounces at mail.linuxgrrls.org [mailto:rxtx-bounces at mail.linuxgrrls.org] On Behalf Of Trent Jarvi Sent: Thursday, April 07, 2005 6:23 PM To: Java RXTX discussion Subject: Re: [Rxtx] Input/output error in writeArray On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a > Windows box. Everything connects up fine, and I can send and receive > a simple sequence of bytes with no problems. However, if around 5 > seconds goes by without me sending something, I get the following when > I attempt to send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at mail.linuxgrrls.org http://mail.linuxgrrls.org/mailman/listinfo/rxtx From ricardo.trindade at emation.pt Mon Apr 4 09:17:23 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Mon, 04 Apr 2005 16:17:23 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot Message-ID: <42515A83.4050907@emation.pt> Hi, I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most recent stable snapshot), and get the following exception : It looks like rxtx has been compiled with jdk 1.5. If this was indeed the case, I think there is a compilation flag that generates code that runs on older jdks. java.lang.UnsupportedClassVersionError: gnu/io/UnsupportedCommOperationException (Unsupported major.minor version 49.0) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at java.net.URLClassLoader.defineClass(URLClassLoader.java:251) at java.net.URLClassLoader.access$100(URLClassLoader.java:55) at java.net.URLClassLoader$1.run(URLClassLoader.java:194) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:187) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:141) I'm trying to run it with 1.4. thanks Ricardo From taj at www.linux.org.uk Tue Apr 5 00:48:12 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 07:48:12 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42515A83.4050907@emation.pt> References: <42515A83.4050907@emation.pt> Message-ID: On Mon, 4 Apr 2005, Ricardo Trindade wrote: > Hi, > > I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most > recent stable snapshot), and get the following exception : > > It looks like rxtx has been compiled with jdk 1.5. If this was > indeed the case, I think there is a compilation flag that generates code > that runs on older jdks. > > java.lang.UnsupportedClassVersionError: > gnu/io/UnsupportedCommOperationException (Unsupported major.minor > version 49.0) [snip] Thanks Ricardo I recompiled the jar with javac -source 1.3 -target 1.3. That should cover most of the JRE's in use today. I also compiled the rxtx 2.0 x86_64 native library which appeared to be missing. I tried looking for flags to pass gcc 4.0 to make the native libraries more backwards compatible but only found options for C++ which is not used in rxtx. I've got a list of other bugs that I'll be going through in the next few weeks but for now I just left them with the same CVS filename - no code changes. ftp://ftp.qbang.org/pub/rxtx/rxtx-2.0-CVS-20050120-bins.tar.gz ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-CVS-20050120-bins.tar.gz -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Tue Apr 5 02:24:33 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 05 Apr 2005 09:24:33 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: References: <42515A83.4050907@emation.pt> Message-ID: <42524B41.3040300@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050405/5919abbb/attachment-0051.html From taj at www.linux.org.uk Tue Apr 5 03:00:29 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 10:00:29 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42524B41.3040300@emation.pt> References: <42515A83.4050907@emation.pt> <42524B41.3040300@emation.pt> Message-ID: On Tue, 5 Apr 2005, Ricardo Trindade wrote: > Will you anounce to the list when a new release is available ? > There will be several incremental releases announced here. Once those are done, we will release 2.1.7 and 2.0.7. -- Trent Jarvi taj at www.linux.org.uk From no_spam at somewhere.com Tue Apr 5 11:55:37 2005 From: no_spam at somewhere.com (no_spam@somewhere.com) Date: Tue, 5 Apr 2005 13:55:37 -0400 Subject: [Rxtx] Closing a port from an event listener results in a deadlock Message-ID: <20050405175537.GA21747@rcog.homelinux.net> On the message I sent on March 14, does anyone had the chance to try the modification? Or was it already fixed? (I haven't searched the archive extensively) Or maybe my message got catched by some spam filters? (it made it to the list archive though) Anyway, I would appreciate some feedback (through the list) Thanks From taj at www.linux.org.uk Tue Apr 5 14:42:28 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 21:42:28 +0100 (BST) Subject: [Rxtx] Closing a port from an event listener results in a deadlock In-Reply-To: <20050405175537.GA21747@rcog.homelinux.net> References: <20050405175537.GA21747@rcog.homelinux.net> Message-ID: On Tue, 5 Apr 2005 no_spam at somewhere.com wrote: > On the message I sent on March 14, does anyone had the chance to try the > modification? > > Or was it already fixed? (I haven't searched the archive extensively) > > Or maybe my message got catched by some spam filters? (it made it to the list > archive though) > > Anyway, I would appreciate some feedback (through the list) > The patch is here http://marc.theaimsgroup.com/?l=rxtx&m=111084488820288&w=2 I have applied this patch to a local copy but will not be doing formal testing for a couple weeks. I do not try to close ports from inside the eventListenter usually so I encourage any feedback also. If there are no problems reported, I expect this will go into rxtx 2.1-7. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Wed Apr 6 08:33:42 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Wed, 06 Apr 2005 15:33:42 +0100 Subject: [Rxtx] getting RXTX version Message-ID: <4253F346.50102@emation.pt> Hi, I want to make sure my deployments have the same version of RXTX jar and native lib. I know the version of the jar can be obtained in the Version class, but how can I obtain the native version ? I know RXTX prints to the console a warning if the version is different. Is there a way to programatically know is this is the case ? I would like to log that to our app's log thanks Ricardo From taj at www.linux.org.uk Wed Apr 6 15:10:20 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 6 Apr 2005 22:10:20 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4253F346.50102@emation.pt> References: <4253F346.50102@emation.pt> Message-ID: On Wed, 6 Apr 2005, Ricardo Trindade wrote: > Hi, > > I want to make sure my deployments have the same version of RXTX jar > and native lib. > > I know the version of the jar can be obtained in the Version class, > but how can I obtain the native version ? > > I know RXTX prints to the console a warning if the version is > different. Is there a way to programatically know is this is the case ? > > I would like to log that to our app's log > There isn't a suggested way of doing that right now. We could move things around and have a static String RXTXVersion.getNativeVersion() in future releases. Is this what you expected? This is not documented in commapi at all. I just tossed that in to catch conflicts while developing. It would be nice to have access in GUI applications though. It may be possible to access RXTXCommDriver.LibVersion right now. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Thu Apr 7 02:51:00 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 09:51:00 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> Message-ID: <4254F474.7020905@emation.pt> >There isn't a suggested way of doing that right now. We could move things >around and have a static String RXTXVersion.getNativeVersion() in future >releases. Is this what you expected? > > Yes, that would be perfect. >This is not documented in commapi at all. I just tossed that in to catch >conflicts while developing. It would be nice to have access in GUI >applications though. > >It may be possible to access RXTXCommDriver.LibVersion right now. > > > I tried, and I don't think it's possible. From taj at www.linux.org.uk Thu Apr 7 03:32:04 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 7 Apr 2005 10:32:04 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4254F474.7020905@emation.pt> References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: On Thu, 7 Apr 2005, Ricardo Trindade wrote: > > >There isn't a suggested way of doing that right now. We could move things > >around and have a static String RXTXVersion.getNativeVersion() in future > >releases. Is this what you expected? > > > > > > Yes, that would be perfect. > The attached should do what you want. You will still need to catch an exception for older versions... -- Trent Jarvi taj at www.linux.org.uk -------------- next part -------------- ? public_version.patch Index: RXTXCommDriver.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXCommDriver.java,v retrieving revision 1.16.2.51 diff -u -r1.16.2.51 RXTXCommDriver.java --- RXTXCommDriver.java 12 Oct 2004 09:13:30 -0000 1.16.2.51 +++ RXTXCommDriver.java 7 Apr 2005 09:29:04 -0000 @@ -54,7 +54,7 @@ the Library. */ String JarVersion = RXTXVersion.getVersion(); - String LibVersion = nativeGetVersion(); + String LibVersion = RXTXVersion.nativeGetVersion(); if ( devel ) { System.out.println("Devel Library"); @@ -76,7 +76,6 @@ /** Get the Serial port prefixes for the running OS */ private String deviceDirectory; private String osName; - private static native String nativeGetVersion(); private native boolean registerKnownPorts(int PortType); private native boolean isPortPrefixValid(String dev); private native boolean testRead(String dev, int type); Index: RXTXVersion.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXVersion.java,v retrieving revision 1.2.2.31 diff -u -r1.2.2.31 RXTXVersion.java --- RXTXVersion.java 16 Oct 2004 16:20:35 -0000 1.2.2.31 +++ RXTXVersion.java 7 Apr 2005 09:29:04 -0000 @@ -36,6 +36,7 @@ private static String Version; static { + System.loadLibrary( "rxtxSerial" ); Version = "RXTX-2.1-7pre20"; } /** @@ -47,4 +48,5 @@ { return(Version); } + public static native String nativeGetVersion(); } Index: SerialImp.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v retrieving revision 1.46.2.181 diff -u -r1.46.2.181 SerialImp.c --- SerialImp.c 17 Oct 2004 09:48:56 -0000 1.46.2.181 +++ SerialImp.c 7 Apr 2005 09:29:07 -0000 @@ -116,6 +116,7 @@ * It will eventually be removed. * */ #define RXTXPort(foo) Java_gnu_io_RXTXPort_ ## foo +#define RXTXVersion(foo) Java_gnu_io_RXTXVersion_ ## foo #define RXTXCommDriver(foo) Java_gnu_io_RXTXCommDriver_ ## foo #if defined(__sun__) || defined(__hpux__) @@ -4001,7 +4002,7 @@ } /*---------------------------------------------------------- -RXTXCommDriver.nativeGetVersion +RXTXVersion.nativeGetVersion accept: none perform: return the current version @@ -4010,9 +4011,10 @@ comments: This is used to avoid mixing versions of the .jar and native library. First introduced in rxtx-1.5-9 + Moved from RXTXCommDriver to RXTXVersion in rxtx-2.1-7 ----------------------------------------------------------*/ -JNIEXPORT jstring JNICALL RXTXCommDriver(nativeGetVersion) (JNIEnv *env, +JNIEXPORT jstring JNICALL RXTXVersion(nativeGetVersion) (JNIEnv *env, jclass jclazz ) { return (*env)->NewStringUTF( env, "RXTX-2.1-7pre20" ); From ricardo.trindade at emation.pt Thu Apr 7 03:45:58 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 10:45:58 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: <42550156.2040908@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050407/05212451/attachment-0051.html From thomas.shulok at lmco.com Thu Apr 7 17:43:11 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Thu, 07 Apr 2005 19:43:11 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi There, I'm attempting to talk RS232 between an embedded Linux box and a Windows box. Everything connects up fine, and I can send and receive a simple sequence of bytes with no problems. However, if around 5 seconds goes by without me sending something, I get the following when I attempt to send. java.io.IOException: Input/output error in writeArray Stack trace: java/lang/Throwable.()V java/lang/Throwable.(Ljava/lang/String;)V java/io/IOException.(Ljava/lang/String;)V gnu/io/RXTXPort.writeArray([BIIZ)V gnu/io/RXTXPort$SerialOutputStream.write([B)V SerialTest.main([Ljava/lang/String;)V If there interval is shorter (say 2 seconds between sends), I have no problems. On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and librxtxSerial-2.0.7pre2.so. Any ideas? Thanks, Thom -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5b23dcf/attachment-0051.html From taj at www.linux.org.uk Thu Apr 7 19:22:36 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:22:36 +0100 (BST) Subject: [Rxtx] Input/output error in writeArray In-Reply-To: References: Message-ID: On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a Windows > box. Everything connects up fine, and I can send and receive a simple > sequence of bytes with no problems. However, if around 5 seconds goes > by without me sending something, I get the following when I attempt to > send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Apr 7 19:24:59 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:24:59 +0100 (BST) Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) Message-ID: hmm. This would not work from applets would it? -- Trent Jarvi taj at www.linux.org.uk ---------- Forwarded message ---------- Date: Thu, 07 Apr 2005 16:05:53 -0400 From: Chris Gaffney To: taj at www.linux.org.uk Subject: RXTX Libraries on Classpath fix Hi, I submitted a patch for RXTX a few weeks ago to allow for loading the native libraries from the classpath. Since sending it to you I found it wasn't working on windows. I've fixed the problem and created a new patch that should replace the older one. The actual change is a one line from a String.equals() to a String.startsWith(). Thanks for a great piece of software, -Chris Gaffney Grand Valley State University -------------- next part -------------- A non-text attachment was scrubbed... Name: libraries_on_classpath_fixed.patch Type: text/x-patch Size: 5617 bytes Desc: Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5d423b8/libraries_on_classpath_fixed-0051.bin From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From thomas.shulok at lmco.com Fri Apr 8 10:38:55 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Fri, 08 Apr 2005 12:38:55 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi Trent, Thanks for the prompt response. Before diving deeper, I was wondering if there is a timeout parameter somewhere in the stack that I have not set properly. Given the nature of the failure (only fails if the line has been idle for a few seconds), it feels like some kind of timeout issue... Thanks again, Thom -----Original Message----- From: rxtx-bounces at mail.linuxgrrls.org [mailto:rxtx-bounces at mail.linuxgrrls.org] On Behalf Of Trent Jarvi Sent: Thursday, April 07, 2005 6:23 PM To: Java RXTX discussion Subject: Re: [Rxtx] Input/output error in writeArray On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a > Windows box. Everything connects up fine, and I can send and receive > a simple sequence of bytes with no problems. However, if around 5 > seconds goes by without me sending something, I get the following when > I attempt to send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at mail.linuxgrrls.org http://mail.linuxgrrls.org/mailman/listinfo/rxtx From ricardo.trindade at emation.pt Mon Apr 4 09:17:23 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Mon, 04 Apr 2005 16:17:23 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot Message-ID: <42515A83.4050907@emation.pt> Hi, I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most recent stable snapshot), and get the following exception : It looks like rxtx has been compiled with jdk 1.5. If this was indeed the case, I think there is a compilation flag that generates code that runs on older jdks. java.lang.UnsupportedClassVersionError: gnu/io/UnsupportedCommOperationException (Unsupported major.minor version 49.0) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at java.net.URLClassLoader.defineClass(URLClassLoader.java:251) at java.net.URLClassLoader.access$100(URLClassLoader.java:55) at java.net.URLClassLoader$1.run(URLClassLoader.java:194) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:187) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:141) I'm trying to run it with 1.4. thanks Ricardo From taj at www.linux.org.uk Tue Apr 5 00:48:12 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 07:48:12 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42515A83.4050907@emation.pt> References: <42515A83.4050907@emation.pt> Message-ID: On Mon, 4 Apr 2005, Ricardo Trindade wrote: > Hi, > > I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most > recent stable snapshot), and get the following exception : > > It looks like rxtx has been compiled with jdk 1.5. If this was > indeed the case, I think there is a compilation flag that generates code > that runs on older jdks. > > java.lang.UnsupportedClassVersionError: > gnu/io/UnsupportedCommOperationException (Unsupported major.minor > version 49.0) [snip] Thanks Ricardo I recompiled the jar with javac -source 1.3 -target 1.3. That should cover most of the JRE's in use today. I also compiled the rxtx 2.0 x86_64 native library which appeared to be missing. I tried looking for flags to pass gcc 4.0 to make the native libraries more backwards compatible but only found options for C++ which is not used in rxtx. I've got a list of other bugs that I'll be going through in the next few weeks but for now I just left them with the same CVS filename - no code changes. ftp://ftp.qbang.org/pub/rxtx/rxtx-2.0-CVS-20050120-bins.tar.gz ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-CVS-20050120-bins.tar.gz -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Tue Apr 5 02:24:33 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 05 Apr 2005 09:24:33 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: References: <42515A83.4050907@emation.pt> Message-ID: <42524B41.3040300@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050405/5919abbb/attachment-0052.html From taj at www.linux.org.uk Tue Apr 5 03:00:29 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 10:00:29 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42524B41.3040300@emation.pt> References: <42515A83.4050907@emation.pt> <42524B41.3040300@emation.pt> Message-ID: On Tue, 5 Apr 2005, Ricardo Trindade wrote: > Will you anounce to the list when a new release is available ? > There will be several incremental releases announced here. Once those are done, we will release 2.1.7 and 2.0.7. -- Trent Jarvi taj at www.linux.org.uk From no_spam at somewhere.com Tue Apr 5 11:55:37 2005 From: no_spam at somewhere.com (no_spam@somewhere.com) Date: Tue, 5 Apr 2005 13:55:37 -0400 Subject: [Rxtx] Closing a port from an event listener results in a deadlock Message-ID: <20050405175537.GA21747@rcog.homelinux.net> On the message I sent on March 14, does anyone had the chance to try the modification? Or was it already fixed? (I haven't searched the archive extensively) Or maybe my message got catched by some spam filters? (it made it to the list archive though) Anyway, I would appreciate some feedback (through the list) Thanks From taj at www.linux.org.uk Tue Apr 5 14:42:28 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 21:42:28 +0100 (BST) Subject: [Rxtx] Closing a port from an event listener results in a deadlock In-Reply-To: <20050405175537.GA21747@rcog.homelinux.net> References: <20050405175537.GA21747@rcog.homelinux.net> Message-ID: On Tue, 5 Apr 2005 no_spam at somewhere.com wrote: > On the message I sent on March 14, does anyone had the chance to try the > modification? > > Or was it already fixed? (I haven't searched the archive extensively) > > Or maybe my message got catched by some spam filters? (it made it to the list > archive though) > > Anyway, I would appreciate some feedback (through the list) > The patch is here http://marc.theaimsgroup.com/?l=rxtx&m=111084488820288&w=2 I have applied this patch to a local copy but will not be doing formal testing for a couple weeks. I do not try to close ports from inside the eventListenter usually so I encourage any feedback also. If there are no problems reported, I expect this will go into rxtx 2.1-7. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Wed Apr 6 08:33:42 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Wed, 06 Apr 2005 15:33:42 +0100 Subject: [Rxtx] getting RXTX version Message-ID: <4253F346.50102@emation.pt> Hi, I want to make sure my deployments have the same version of RXTX jar and native lib. I know the version of the jar can be obtained in the Version class, but how can I obtain the native version ? I know RXTX prints to the console a warning if the version is different. Is there a way to programatically know is this is the case ? I would like to log that to our app's log thanks Ricardo From taj at www.linux.org.uk Wed Apr 6 15:10:20 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 6 Apr 2005 22:10:20 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4253F346.50102@emation.pt> References: <4253F346.50102@emation.pt> Message-ID: On Wed, 6 Apr 2005, Ricardo Trindade wrote: > Hi, > > I want to make sure my deployments have the same version of RXTX jar > and native lib. > > I know the version of the jar can be obtained in the Version class, > but how can I obtain the native version ? > > I know RXTX prints to the console a warning if the version is > different. Is there a way to programatically know is this is the case ? > > I would like to log that to our app's log > There isn't a suggested way of doing that right now. We could move things around and have a static String RXTXVersion.getNativeVersion() in future releases. Is this what you expected? This is not documented in commapi at all. I just tossed that in to catch conflicts while developing. It would be nice to have access in GUI applications though. It may be possible to access RXTXCommDriver.LibVersion right now. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Thu Apr 7 02:51:00 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 09:51:00 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> Message-ID: <4254F474.7020905@emation.pt> >There isn't a suggested way of doing that right now. We could move things >around and have a static String RXTXVersion.getNativeVersion() in future >releases. Is this what you expected? > > Yes, that would be perfect. >This is not documented in commapi at all. I just tossed that in to catch >conflicts while developing. It would be nice to have access in GUI >applications though. > >It may be possible to access RXTXCommDriver.LibVersion right now. > > > I tried, and I don't think it's possible. From taj at www.linux.org.uk Thu Apr 7 03:32:04 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 7 Apr 2005 10:32:04 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4254F474.7020905@emation.pt> References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: On Thu, 7 Apr 2005, Ricardo Trindade wrote: > > >There isn't a suggested way of doing that right now. We could move things > >around and have a static String RXTXVersion.getNativeVersion() in future > >releases. Is this what you expected? > > > > > > Yes, that would be perfect. > The attached should do what you want. You will still need to catch an exception for older versions... -- Trent Jarvi taj at www.linux.org.uk -------------- next part -------------- ? public_version.patch Index: RXTXCommDriver.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXCommDriver.java,v retrieving revision 1.16.2.51 diff -u -r1.16.2.51 RXTXCommDriver.java --- RXTXCommDriver.java 12 Oct 2004 09:13:30 -0000 1.16.2.51 +++ RXTXCommDriver.java 7 Apr 2005 09:29:04 -0000 @@ -54,7 +54,7 @@ the Library. */ String JarVersion = RXTXVersion.getVersion(); - String LibVersion = nativeGetVersion(); + String LibVersion = RXTXVersion.nativeGetVersion(); if ( devel ) { System.out.println("Devel Library"); @@ -76,7 +76,6 @@ /** Get the Serial port prefixes for the running OS */ private String deviceDirectory; private String osName; - private static native String nativeGetVersion(); private native boolean registerKnownPorts(int PortType); private native boolean isPortPrefixValid(String dev); private native boolean testRead(String dev, int type); Index: RXTXVersion.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXVersion.java,v retrieving revision 1.2.2.31 diff -u -r1.2.2.31 RXTXVersion.java --- RXTXVersion.java 16 Oct 2004 16:20:35 -0000 1.2.2.31 +++ RXTXVersion.java 7 Apr 2005 09:29:04 -0000 @@ -36,6 +36,7 @@ private static String Version; static { + System.loadLibrary( "rxtxSerial" ); Version = "RXTX-2.1-7pre20"; } /** @@ -47,4 +48,5 @@ { return(Version); } + public static native String nativeGetVersion(); } Index: SerialImp.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v retrieving revision 1.46.2.181 diff -u -r1.46.2.181 SerialImp.c --- SerialImp.c 17 Oct 2004 09:48:56 -0000 1.46.2.181 +++ SerialImp.c 7 Apr 2005 09:29:07 -0000 @@ -116,6 +116,7 @@ * It will eventually be removed. * */ #define RXTXPort(foo) Java_gnu_io_RXTXPort_ ## foo +#define RXTXVersion(foo) Java_gnu_io_RXTXVersion_ ## foo #define RXTXCommDriver(foo) Java_gnu_io_RXTXCommDriver_ ## foo #if defined(__sun__) || defined(__hpux__) @@ -4001,7 +4002,7 @@ } /*---------------------------------------------------------- -RXTXCommDriver.nativeGetVersion +RXTXVersion.nativeGetVersion accept: none perform: return the current version @@ -4010,9 +4011,10 @@ comments: This is used to avoid mixing versions of the .jar and native library. First introduced in rxtx-1.5-9 + Moved from RXTXCommDriver to RXTXVersion in rxtx-2.1-7 ----------------------------------------------------------*/ -JNIEXPORT jstring JNICALL RXTXCommDriver(nativeGetVersion) (JNIEnv *env, +JNIEXPORT jstring JNICALL RXTXVersion(nativeGetVersion) (JNIEnv *env, jclass jclazz ) { return (*env)->NewStringUTF( env, "RXTX-2.1-7pre20" ); From ricardo.trindade at emation.pt Thu Apr 7 03:45:58 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 10:45:58 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: <42550156.2040908@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050407/05212451/attachment-0052.html From thomas.shulok at lmco.com Thu Apr 7 17:43:11 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Thu, 07 Apr 2005 19:43:11 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi There, I'm attempting to talk RS232 between an embedded Linux box and a Windows box. Everything connects up fine, and I can send and receive a simple sequence of bytes with no problems. However, if around 5 seconds goes by without me sending something, I get the following when I attempt to send. java.io.IOException: Input/output error in writeArray Stack trace: java/lang/Throwable.()V java/lang/Throwable.(Ljava/lang/String;)V java/io/IOException.(Ljava/lang/String;)V gnu/io/RXTXPort.writeArray([BIIZ)V gnu/io/RXTXPort$SerialOutputStream.write([B)V SerialTest.main([Ljava/lang/String;)V If there interval is shorter (say 2 seconds between sends), I have no problems. On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and librxtxSerial-2.0.7pre2.so. Any ideas? Thanks, Thom -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5b23dcf/attachment-0052.html From taj at www.linux.org.uk Thu Apr 7 19:22:36 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:22:36 +0100 (BST) Subject: [Rxtx] Input/output error in writeArray In-Reply-To: References: Message-ID: On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a Windows > box. Everything connects up fine, and I can send and receive a simple > sequence of bytes with no problems. However, if around 5 seconds goes > by without me sending something, I get the following when I attempt to > send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Apr 7 19:24:59 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:24:59 +0100 (BST) Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) Message-ID: hmm. This would not work from applets would it? -- Trent Jarvi taj at www.linux.org.uk ---------- Forwarded message ---------- Date: Thu, 07 Apr 2005 16:05:53 -0400 From: Chris Gaffney To: taj at www.linux.org.uk Subject: RXTX Libraries on Classpath fix Hi, I submitted a patch for RXTX a few weeks ago to allow for loading the native libraries from the classpath. Since sending it to you I found it wasn't working on windows. I've fixed the problem and created a new patch that should replace the older one. The actual change is a one line from a String.equals() to a String.startsWith(). Thanks for a great piece of software, -Chris Gaffney Grand Valley State University -------------- next part -------------- A non-text attachment was scrubbed... Name: libraries_on_classpath_fixed.patch Type: text/x-patch Size: 5617 bytes Desc: Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5d423b8/libraries_on_classpath_fixed-0052.bin From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From thomas.shulok at lmco.com Fri Apr 8 10:38:55 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Fri, 08 Apr 2005 12:38:55 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi Trent, Thanks for the prompt response. Before diving deeper, I was wondering if there is a timeout parameter somewhere in the stack that I have not set properly. Given the nature of the failure (only fails if the line has been idle for a few seconds), it feels like some kind of timeout issue... Thanks again, Thom -----Original Message----- From: rxtx-bounces at mail.linuxgrrls.org [mailto:rxtx-bounces at mail.linuxgrrls.org] On Behalf Of Trent Jarvi Sent: Thursday, April 07, 2005 6:23 PM To: Java RXTX discussion Subject: Re: [Rxtx] Input/output error in writeArray On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a > Windows box. Everything connects up fine, and I can send and receive > a simple sequence of bytes with no problems. However, if around 5 > seconds goes by without me sending something, I get the following when > I attempt to send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at mail.linuxgrrls.org http://mail.linuxgrrls.org/mailman/listinfo/rxtx From ricardo.trindade at emation.pt Mon Apr 4 09:17:23 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Mon, 04 Apr 2005 16:17:23 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot Message-ID: <42515A83.4050907@emation.pt> Hi, I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most recent stable snapshot), and get the following exception : It looks like rxtx has been compiled with jdk 1.5. If this was indeed the case, I think there is a compilation flag that generates code that runs on older jdks. java.lang.UnsupportedClassVersionError: gnu/io/UnsupportedCommOperationException (Unsupported major.minor version 49.0) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at java.net.URLClassLoader.defineClass(URLClassLoader.java:251) at java.net.URLClassLoader.access$100(URLClassLoader.java:55) at java.net.URLClassLoader$1.run(URLClassLoader.java:194) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:187) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:141) I'm trying to run it with 1.4. thanks Ricardo From taj at www.linux.org.uk Tue Apr 5 00:48:12 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 07:48:12 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42515A83.4050907@emation.pt> References: <42515A83.4050907@emation.pt> Message-ID: On Mon, 4 Apr 2005, Ricardo Trindade wrote: > Hi, > > I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most > recent stable snapshot), and get the following exception : > > It looks like rxtx has been compiled with jdk 1.5. If this was > indeed the case, I think there is a compilation flag that generates code > that runs on older jdks. > > java.lang.UnsupportedClassVersionError: > gnu/io/UnsupportedCommOperationException (Unsupported major.minor > version 49.0) [snip] Thanks Ricardo I recompiled the jar with javac -source 1.3 -target 1.3. That should cover most of the JRE's in use today. I also compiled the rxtx 2.0 x86_64 native library which appeared to be missing. I tried looking for flags to pass gcc 4.0 to make the native libraries more backwards compatible but only found options for C++ which is not used in rxtx. I've got a list of other bugs that I'll be going through in the next few weeks but for now I just left them with the same CVS filename - no code changes. ftp://ftp.qbang.org/pub/rxtx/rxtx-2.0-CVS-20050120-bins.tar.gz ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-CVS-20050120-bins.tar.gz -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Tue Apr 5 02:24:33 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 05 Apr 2005 09:24:33 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: References: <42515A83.4050907@emation.pt> Message-ID: <42524B41.3040300@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050405/5919abbb/attachment-0053.html From taj at www.linux.org.uk Tue Apr 5 03:00:29 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 10:00:29 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42524B41.3040300@emation.pt> References: <42515A83.4050907@emation.pt> <42524B41.3040300@emation.pt> Message-ID: On Tue, 5 Apr 2005, Ricardo Trindade wrote: > Will you anounce to the list when a new release is available ? > There will be several incremental releases announced here. Once those are done, we will release 2.1.7 and 2.0.7. -- Trent Jarvi taj at www.linux.org.uk From no_spam at somewhere.com Tue Apr 5 11:55:37 2005 From: no_spam at somewhere.com (no_spam@somewhere.com) Date: Tue, 5 Apr 2005 13:55:37 -0400 Subject: [Rxtx] Closing a port from an event listener results in a deadlock Message-ID: <20050405175537.GA21747@rcog.homelinux.net> On the message I sent on March 14, does anyone had the chance to try the modification? Or was it already fixed? (I haven't searched the archive extensively) Or maybe my message got catched by some spam filters? (it made it to the list archive though) Anyway, I would appreciate some feedback (through the list) Thanks From taj at www.linux.org.uk Tue Apr 5 14:42:28 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 21:42:28 +0100 (BST) Subject: [Rxtx] Closing a port from an event listener results in a deadlock In-Reply-To: <20050405175537.GA21747@rcog.homelinux.net> References: <20050405175537.GA21747@rcog.homelinux.net> Message-ID: On Tue, 5 Apr 2005 no_spam at somewhere.com wrote: > On the message I sent on March 14, does anyone had the chance to try the > modification? > > Or was it already fixed? (I haven't searched the archive extensively) > > Or maybe my message got catched by some spam filters? (it made it to the list > archive though) > > Anyway, I would appreciate some feedback (through the list) > The patch is here http://marc.theaimsgroup.com/?l=rxtx&m=111084488820288&w=2 I have applied this patch to a local copy but will not be doing formal testing for a couple weeks. I do not try to close ports from inside the eventListenter usually so I encourage any feedback also. If there are no problems reported, I expect this will go into rxtx 2.1-7. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Wed Apr 6 08:33:42 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Wed, 06 Apr 2005 15:33:42 +0100 Subject: [Rxtx] getting RXTX version Message-ID: <4253F346.50102@emation.pt> Hi, I want to make sure my deployments have the same version of RXTX jar and native lib. I know the version of the jar can be obtained in the Version class, but how can I obtain the native version ? I know RXTX prints to the console a warning if the version is different. Is there a way to programatically know is this is the case ? I would like to log that to our app's log thanks Ricardo From taj at www.linux.org.uk Wed Apr 6 15:10:20 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 6 Apr 2005 22:10:20 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4253F346.50102@emation.pt> References: <4253F346.50102@emation.pt> Message-ID: On Wed, 6 Apr 2005, Ricardo Trindade wrote: > Hi, > > I want to make sure my deployments have the same version of RXTX jar > and native lib. > > I know the version of the jar can be obtained in the Version class, > but how can I obtain the native version ? > > I know RXTX prints to the console a warning if the version is > different. Is there a way to programatically know is this is the case ? > > I would like to log that to our app's log > There isn't a suggested way of doing that right now. We could move things around and have a static String RXTXVersion.getNativeVersion() in future releases. Is this what you expected? This is not documented in commapi at all. I just tossed that in to catch conflicts while developing. It would be nice to have access in GUI applications though. It may be possible to access RXTXCommDriver.LibVersion right now. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Thu Apr 7 02:51:00 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 09:51:00 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> Message-ID: <4254F474.7020905@emation.pt> >There isn't a suggested way of doing that right now. We could move things >around and have a static String RXTXVersion.getNativeVersion() in future >releases. Is this what you expected? > > Yes, that would be perfect. >This is not documented in commapi at all. I just tossed that in to catch >conflicts while developing. It would be nice to have access in GUI >applications though. > >It may be possible to access RXTXCommDriver.LibVersion right now. > > > I tried, and I don't think it's possible. From taj at www.linux.org.uk Thu Apr 7 03:32:04 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 7 Apr 2005 10:32:04 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4254F474.7020905@emation.pt> References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: On Thu, 7 Apr 2005, Ricardo Trindade wrote: > > >There isn't a suggested way of doing that right now. We could move things > >around and have a static String RXTXVersion.getNativeVersion() in future > >releases. Is this what you expected? > > > > > > Yes, that would be perfect. > The attached should do what you want. You will still need to catch an exception for older versions... -- Trent Jarvi taj at www.linux.org.uk -------------- next part -------------- ? public_version.patch Index: RXTXCommDriver.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXCommDriver.java,v retrieving revision 1.16.2.51 diff -u -r1.16.2.51 RXTXCommDriver.java --- RXTXCommDriver.java 12 Oct 2004 09:13:30 -0000 1.16.2.51 +++ RXTXCommDriver.java 7 Apr 2005 09:29:04 -0000 @@ -54,7 +54,7 @@ the Library. */ String JarVersion = RXTXVersion.getVersion(); - String LibVersion = nativeGetVersion(); + String LibVersion = RXTXVersion.nativeGetVersion(); if ( devel ) { System.out.println("Devel Library"); @@ -76,7 +76,6 @@ /** Get the Serial port prefixes for the running OS */ private String deviceDirectory; private String osName; - private static native String nativeGetVersion(); private native boolean registerKnownPorts(int PortType); private native boolean isPortPrefixValid(String dev); private native boolean testRead(String dev, int type); Index: RXTXVersion.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXVersion.java,v retrieving revision 1.2.2.31 diff -u -r1.2.2.31 RXTXVersion.java --- RXTXVersion.java 16 Oct 2004 16:20:35 -0000 1.2.2.31 +++ RXTXVersion.java 7 Apr 2005 09:29:04 -0000 @@ -36,6 +36,7 @@ private static String Version; static { + System.loadLibrary( "rxtxSerial" ); Version = "RXTX-2.1-7pre20"; } /** @@ -47,4 +48,5 @@ { return(Version); } + public static native String nativeGetVersion(); } Index: SerialImp.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v retrieving revision 1.46.2.181 diff -u -r1.46.2.181 SerialImp.c --- SerialImp.c 17 Oct 2004 09:48:56 -0000 1.46.2.181 +++ SerialImp.c 7 Apr 2005 09:29:07 -0000 @@ -116,6 +116,7 @@ * It will eventually be removed. * */ #define RXTXPort(foo) Java_gnu_io_RXTXPort_ ## foo +#define RXTXVersion(foo) Java_gnu_io_RXTXVersion_ ## foo #define RXTXCommDriver(foo) Java_gnu_io_RXTXCommDriver_ ## foo #if defined(__sun__) || defined(__hpux__) @@ -4001,7 +4002,7 @@ } /*---------------------------------------------------------- -RXTXCommDriver.nativeGetVersion +RXTXVersion.nativeGetVersion accept: none perform: return the current version @@ -4010,9 +4011,10 @@ comments: This is used to avoid mixing versions of the .jar and native library. First introduced in rxtx-1.5-9 + Moved from RXTXCommDriver to RXTXVersion in rxtx-2.1-7 ----------------------------------------------------------*/ -JNIEXPORT jstring JNICALL RXTXCommDriver(nativeGetVersion) (JNIEnv *env, +JNIEXPORT jstring JNICALL RXTXVersion(nativeGetVersion) (JNIEnv *env, jclass jclazz ) { return (*env)->NewStringUTF( env, "RXTX-2.1-7pre20" ); From ricardo.trindade at emation.pt Thu Apr 7 03:45:58 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 10:45:58 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: <42550156.2040908@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050407/05212451/attachment-0053.html From thomas.shulok at lmco.com Thu Apr 7 17:43:11 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Thu, 07 Apr 2005 19:43:11 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi There, I'm attempting to talk RS232 between an embedded Linux box and a Windows box. Everything connects up fine, and I can send and receive a simple sequence of bytes with no problems. However, if around 5 seconds goes by without me sending something, I get the following when I attempt to send. java.io.IOException: Input/output error in writeArray Stack trace: java/lang/Throwable.()V java/lang/Throwable.(Ljava/lang/String;)V java/io/IOException.(Ljava/lang/String;)V gnu/io/RXTXPort.writeArray([BIIZ)V gnu/io/RXTXPort$SerialOutputStream.write([B)V SerialTest.main([Ljava/lang/String;)V If there interval is shorter (say 2 seconds between sends), I have no problems. On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and librxtxSerial-2.0.7pre2.so. Any ideas? Thanks, Thom -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5b23dcf/attachment-0053.html From taj at www.linux.org.uk Thu Apr 7 19:22:36 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:22:36 +0100 (BST) Subject: [Rxtx] Input/output error in writeArray In-Reply-To: References: Message-ID: On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a Windows > box. Everything connects up fine, and I can send and receive a simple > sequence of bytes with no problems. However, if around 5 seconds goes > by without me sending something, I get the following when I attempt to > send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Apr 7 19:24:59 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:24:59 +0100 (BST) Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) Message-ID: hmm. This would not work from applets would it? -- Trent Jarvi taj at www.linux.org.uk ---------- Forwarded message ---------- Date: Thu, 07 Apr 2005 16:05:53 -0400 From: Chris Gaffney To: taj at www.linux.org.uk Subject: RXTX Libraries on Classpath fix Hi, I submitted a patch for RXTX a few weeks ago to allow for loading the native libraries from the classpath. Since sending it to you I found it wasn't working on windows. I've fixed the problem and created a new patch that should replace the older one. The actual change is a one line from a String.equals() to a String.startsWith(). Thanks for a great piece of software, -Chris Gaffney Grand Valley State University -------------- next part -------------- A non-text attachment was scrubbed... Name: libraries_on_classpath_fixed.patch Type: text/x-patch Size: 5617 bytes Desc: Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5d423b8/libraries_on_classpath_fixed-0053.bin From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From thomas.shulok at lmco.com Fri Apr 8 10:38:55 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Fri, 08 Apr 2005 12:38:55 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi Trent, Thanks for the prompt response. Before diving deeper, I was wondering if there is a timeout parameter somewhere in the stack that I have not set properly. Given the nature of the failure (only fails if the line has been idle for a few seconds), it feels like some kind of timeout issue... Thanks again, Thom -----Original Message----- From: rxtx-bounces at mail.linuxgrrls.org [mailto:rxtx-bounces at mail.linuxgrrls.org] On Behalf Of Trent Jarvi Sent: Thursday, April 07, 2005 6:23 PM To: Java RXTX discussion Subject: Re: [Rxtx] Input/output error in writeArray On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a > Windows box. Everything connects up fine, and I can send and receive > a simple sequence of bytes with no problems. However, if around 5 > seconds goes by without me sending something, I get the following when > I attempt to send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at mail.linuxgrrls.org http://mail.linuxgrrls.org/mailman/listinfo/rxtx From ricardo.trindade at emation.pt Mon Apr 4 09:17:23 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Mon, 04 Apr 2005 16:17:23 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot Message-ID: <42515A83.4050907@emation.pt> Hi, I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most recent stable snapshot), and get the following exception : It looks like rxtx has been compiled with jdk 1.5. If this was indeed the case, I think there is a compilation flag that generates code that runs on older jdks. java.lang.UnsupportedClassVersionError: gnu/io/UnsupportedCommOperationException (Unsupported major.minor version 49.0) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at java.net.URLClassLoader.defineClass(URLClassLoader.java:251) at java.net.URLClassLoader.access$100(URLClassLoader.java:55) at java.net.URLClassLoader$1.run(URLClassLoader.java:194) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:187) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:141) I'm trying to run it with 1.4. thanks Ricardo From taj at www.linux.org.uk Tue Apr 5 00:48:12 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 07:48:12 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42515A83.4050907@emation.pt> References: <42515A83.4050907@emation.pt> Message-ID: On Mon, 4 Apr 2005, Ricardo Trindade wrote: > Hi, > > I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most > recent stable snapshot), and get the following exception : > > It looks like rxtx has been compiled with jdk 1.5. If this was > indeed the case, I think there is a compilation flag that generates code > that runs on older jdks. > > java.lang.UnsupportedClassVersionError: > gnu/io/UnsupportedCommOperationException (Unsupported major.minor > version 49.0) [snip] Thanks Ricardo I recompiled the jar with javac -source 1.3 -target 1.3. That should cover most of the JRE's in use today. I also compiled the rxtx 2.0 x86_64 native library which appeared to be missing. I tried looking for flags to pass gcc 4.0 to make the native libraries more backwards compatible but only found options for C++ which is not used in rxtx. I've got a list of other bugs that I'll be going through in the next few weeks but for now I just left them with the same CVS filename - no code changes. ftp://ftp.qbang.org/pub/rxtx/rxtx-2.0-CVS-20050120-bins.tar.gz ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-CVS-20050120-bins.tar.gz -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Tue Apr 5 02:24:33 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 05 Apr 2005 09:24:33 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: References: <42515A83.4050907@emation.pt> Message-ID: <42524B41.3040300@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050405/5919abbb/attachment-0054.html From taj at www.linux.org.uk Tue Apr 5 03:00:29 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 10:00:29 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42524B41.3040300@emation.pt> References: <42515A83.4050907@emation.pt> <42524B41.3040300@emation.pt> Message-ID: On Tue, 5 Apr 2005, Ricardo Trindade wrote: > Will you anounce to the list when a new release is available ? > There will be several incremental releases announced here. Once those are done, we will release 2.1.7 and 2.0.7. -- Trent Jarvi taj at www.linux.org.uk From no_spam at somewhere.com Tue Apr 5 11:55:37 2005 From: no_spam at somewhere.com (no_spam@somewhere.com) Date: Tue, 5 Apr 2005 13:55:37 -0400 Subject: [Rxtx] Closing a port from an event listener results in a deadlock Message-ID: <20050405175537.GA21747@rcog.homelinux.net> On the message I sent on March 14, does anyone had the chance to try the modification? Or was it already fixed? (I haven't searched the archive extensively) Or maybe my message got catched by some spam filters? (it made it to the list archive though) Anyway, I would appreciate some feedback (through the list) Thanks From taj at www.linux.org.uk Tue Apr 5 14:42:28 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 21:42:28 +0100 (BST) Subject: [Rxtx] Closing a port from an event listener results in a deadlock In-Reply-To: <20050405175537.GA21747@rcog.homelinux.net> References: <20050405175537.GA21747@rcog.homelinux.net> Message-ID: On Tue, 5 Apr 2005 no_spam at somewhere.com wrote: > On the message I sent on March 14, does anyone had the chance to try the > modification? > > Or was it already fixed? (I haven't searched the archive extensively) > > Or maybe my message got catched by some spam filters? (it made it to the list > archive though) > > Anyway, I would appreciate some feedback (through the list) > The patch is here http://marc.theaimsgroup.com/?l=rxtx&m=111084488820288&w=2 I have applied this patch to a local copy but will not be doing formal testing for a couple weeks. I do not try to close ports from inside the eventListenter usually so I encourage any feedback also. If there are no problems reported, I expect this will go into rxtx 2.1-7. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Wed Apr 6 08:33:42 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Wed, 06 Apr 2005 15:33:42 +0100 Subject: [Rxtx] getting RXTX version Message-ID: <4253F346.50102@emation.pt> Hi, I want to make sure my deployments have the same version of RXTX jar and native lib. I know the version of the jar can be obtained in the Version class, but how can I obtain the native version ? I know RXTX prints to the console a warning if the version is different. Is there a way to programatically know is this is the case ? I would like to log that to our app's log thanks Ricardo From taj at www.linux.org.uk Wed Apr 6 15:10:20 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 6 Apr 2005 22:10:20 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4253F346.50102@emation.pt> References: <4253F346.50102@emation.pt> Message-ID: On Wed, 6 Apr 2005, Ricardo Trindade wrote: > Hi, > > I want to make sure my deployments have the same version of RXTX jar > and native lib. > > I know the version of the jar can be obtained in the Version class, > but how can I obtain the native version ? > > I know RXTX prints to the console a warning if the version is > different. Is there a way to programatically know is this is the case ? > > I would like to log that to our app's log > There isn't a suggested way of doing that right now. We could move things around and have a static String RXTXVersion.getNativeVersion() in future releases. Is this what you expected? This is not documented in commapi at all. I just tossed that in to catch conflicts while developing. It would be nice to have access in GUI applications though. It may be possible to access RXTXCommDriver.LibVersion right now. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Thu Apr 7 02:51:00 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 09:51:00 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> Message-ID: <4254F474.7020905@emation.pt> >There isn't a suggested way of doing that right now. We could move things >around and have a static String RXTXVersion.getNativeVersion() in future >releases. Is this what you expected? > > Yes, that would be perfect. >This is not documented in commapi at all. I just tossed that in to catch >conflicts while developing. It would be nice to have access in GUI >applications though. > >It may be possible to access RXTXCommDriver.LibVersion right now. > > > I tried, and I don't think it's possible. From taj at www.linux.org.uk Thu Apr 7 03:32:04 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 7 Apr 2005 10:32:04 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4254F474.7020905@emation.pt> References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: On Thu, 7 Apr 2005, Ricardo Trindade wrote: > > >There isn't a suggested way of doing that right now. We could move things > >around and have a static String RXTXVersion.getNativeVersion() in future > >releases. Is this what you expected? > > > > > > Yes, that would be perfect. > The attached should do what you want. You will still need to catch an exception for older versions... -- Trent Jarvi taj at www.linux.org.uk -------------- next part -------------- ? public_version.patch Index: RXTXCommDriver.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXCommDriver.java,v retrieving revision 1.16.2.51 diff -u -r1.16.2.51 RXTXCommDriver.java --- RXTXCommDriver.java 12 Oct 2004 09:13:30 -0000 1.16.2.51 +++ RXTXCommDriver.java 7 Apr 2005 09:29:04 -0000 @@ -54,7 +54,7 @@ the Library. */ String JarVersion = RXTXVersion.getVersion(); - String LibVersion = nativeGetVersion(); + String LibVersion = RXTXVersion.nativeGetVersion(); if ( devel ) { System.out.println("Devel Library"); @@ -76,7 +76,6 @@ /** Get the Serial port prefixes for the running OS */ private String deviceDirectory; private String osName; - private static native String nativeGetVersion(); private native boolean registerKnownPorts(int PortType); private native boolean isPortPrefixValid(String dev); private native boolean testRead(String dev, int type); Index: RXTXVersion.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXVersion.java,v retrieving revision 1.2.2.31 diff -u -r1.2.2.31 RXTXVersion.java --- RXTXVersion.java 16 Oct 2004 16:20:35 -0000 1.2.2.31 +++ RXTXVersion.java 7 Apr 2005 09:29:04 -0000 @@ -36,6 +36,7 @@ private static String Version; static { + System.loadLibrary( "rxtxSerial" ); Version = "RXTX-2.1-7pre20"; } /** @@ -47,4 +48,5 @@ { return(Version); } + public static native String nativeGetVersion(); } Index: SerialImp.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v retrieving revision 1.46.2.181 diff -u -r1.46.2.181 SerialImp.c --- SerialImp.c 17 Oct 2004 09:48:56 -0000 1.46.2.181 +++ SerialImp.c 7 Apr 2005 09:29:07 -0000 @@ -116,6 +116,7 @@ * It will eventually be removed. * */ #define RXTXPort(foo) Java_gnu_io_RXTXPort_ ## foo +#define RXTXVersion(foo) Java_gnu_io_RXTXVersion_ ## foo #define RXTXCommDriver(foo) Java_gnu_io_RXTXCommDriver_ ## foo #if defined(__sun__) || defined(__hpux__) @@ -4001,7 +4002,7 @@ } /*---------------------------------------------------------- -RXTXCommDriver.nativeGetVersion +RXTXVersion.nativeGetVersion accept: none perform: return the current version @@ -4010,9 +4011,10 @@ comments: This is used to avoid mixing versions of the .jar and native library. First introduced in rxtx-1.5-9 + Moved from RXTXCommDriver to RXTXVersion in rxtx-2.1-7 ----------------------------------------------------------*/ -JNIEXPORT jstring JNICALL RXTXCommDriver(nativeGetVersion) (JNIEnv *env, +JNIEXPORT jstring JNICALL RXTXVersion(nativeGetVersion) (JNIEnv *env, jclass jclazz ) { return (*env)->NewStringUTF( env, "RXTX-2.1-7pre20" ); From ricardo.trindade at emation.pt Thu Apr 7 03:45:58 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 10:45:58 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: <42550156.2040908@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050407/05212451/attachment-0054.html From thomas.shulok at lmco.com Thu Apr 7 17:43:11 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Thu, 07 Apr 2005 19:43:11 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi There, I'm attempting to talk RS232 between an embedded Linux box and a Windows box. Everything connects up fine, and I can send and receive a simple sequence of bytes with no problems. However, if around 5 seconds goes by without me sending something, I get the following when I attempt to send. java.io.IOException: Input/output error in writeArray Stack trace: java/lang/Throwable.()V java/lang/Throwable.(Ljava/lang/String;)V java/io/IOException.(Ljava/lang/String;)V gnu/io/RXTXPort.writeArray([BIIZ)V gnu/io/RXTXPort$SerialOutputStream.write([B)V SerialTest.main([Ljava/lang/String;)V If there interval is shorter (say 2 seconds between sends), I have no problems. On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and librxtxSerial-2.0.7pre2.so. Any ideas? Thanks, Thom -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5b23dcf/attachment-0054.html From taj at www.linux.org.uk Thu Apr 7 19:22:36 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:22:36 +0100 (BST) Subject: [Rxtx] Input/output error in writeArray In-Reply-To: References: Message-ID: On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a Windows > box. Everything connects up fine, and I can send and receive a simple > sequence of bytes with no problems. However, if around 5 seconds goes > by without me sending something, I get the following when I attempt to > send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Apr 7 19:24:59 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:24:59 +0100 (BST) Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) Message-ID: hmm. This would not work from applets would it? -- Trent Jarvi taj at www.linux.org.uk ---------- Forwarded message ---------- Date: Thu, 07 Apr 2005 16:05:53 -0400 From: Chris Gaffney To: taj at www.linux.org.uk Subject: RXTX Libraries on Classpath fix Hi, I submitted a patch for RXTX a few weeks ago to allow for loading the native libraries from the classpath. Since sending it to you I found it wasn't working on windows. I've fixed the problem and created a new patch that should replace the older one. The actual change is a one line from a String.equals() to a String.startsWith(). Thanks for a great piece of software, -Chris Gaffney Grand Valley State University -------------- next part -------------- A non-text attachment was scrubbed... Name: libraries_on_classpath_fixed.patch Type: text/x-patch Size: 5617 bytes Desc: Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5d423b8/libraries_on_classpath_fixed-0054.bin From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From thomas.shulok at lmco.com Fri Apr 8 10:38:55 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Fri, 08 Apr 2005 12:38:55 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi Trent, Thanks for the prompt response. Before diving deeper, I was wondering if there is a timeout parameter somewhere in the stack that I have not set properly. Given the nature of the failure (only fails if the line has been idle for a few seconds), it feels like some kind of timeout issue... Thanks again, Thom -----Original Message----- From: rxtx-bounces at mail.linuxgrrls.org [mailto:rxtx-bounces at mail.linuxgrrls.org] On Behalf Of Trent Jarvi Sent: Thursday, April 07, 2005 6:23 PM To: Java RXTX discussion Subject: Re: [Rxtx] Input/output error in writeArray On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a > Windows box. Everything connects up fine, and I can send and receive > a simple sequence of bytes with no problems. However, if around 5 > seconds goes by without me sending something, I get the following when > I attempt to send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at mail.linuxgrrls.org http://mail.linuxgrrls.org/mailman/listinfo/rxtx From ricardo.trindade at emation.pt Mon Apr 4 09:17:23 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Mon, 04 Apr 2005 16:17:23 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot Message-ID: <42515A83.4050907@emation.pt> Hi, I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most recent stable snapshot), and get the following exception : It looks like rxtx has been compiled with jdk 1.5. If this was indeed the case, I think there is a compilation flag that generates code that runs on older jdks. java.lang.UnsupportedClassVersionError: gnu/io/UnsupportedCommOperationException (Unsupported major.minor version 49.0) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at java.net.URLClassLoader.defineClass(URLClassLoader.java:251) at java.net.URLClassLoader.access$100(URLClassLoader.java:55) at java.net.URLClassLoader$1.run(URLClassLoader.java:194) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:187) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:141) I'm trying to run it with 1.4. thanks Ricardo From taj at www.linux.org.uk Tue Apr 5 00:48:12 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 07:48:12 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42515A83.4050907@emation.pt> References: <42515A83.4050907@emation.pt> Message-ID: On Mon, 4 Apr 2005, Ricardo Trindade wrote: > Hi, > > I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most > recent stable snapshot), and get the following exception : > > It looks like rxtx has been compiled with jdk 1.5. If this was > indeed the case, I think there is a compilation flag that generates code > that runs on older jdks. > > java.lang.UnsupportedClassVersionError: > gnu/io/UnsupportedCommOperationException (Unsupported major.minor > version 49.0) [snip] Thanks Ricardo I recompiled the jar with javac -source 1.3 -target 1.3. That should cover most of the JRE's in use today. I also compiled the rxtx 2.0 x86_64 native library which appeared to be missing. I tried looking for flags to pass gcc 4.0 to make the native libraries more backwards compatible but only found options for C++ which is not used in rxtx. I've got a list of other bugs that I'll be going through in the next few weeks but for now I just left them with the same CVS filename - no code changes. ftp://ftp.qbang.org/pub/rxtx/rxtx-2.0-CVS-20050120-bins.tar.gz ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-CVS-20050120-bins.tar.gz -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Tue Apr 5 02:24:33 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 05 Apr 2005 09:24:33 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: References: <42515A83.4050907@emation.pt> Message-ID: <42524B41.3040300@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050405/5919abbb/attachment-0055.html From taj at www.linux.org.uk Tue Apr 5 03:00:29 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 10:00:29 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42524B41.3040300@emation.pt> References: <42515A83.4050907@emation.pt> <42524B41.3040300@emation.pt> Message-ID: On Tue, 5 Apr 2005, Ricardo Trindade wrote: > Will you anounce to the list when a new release is available ? > There will be several incremental releases announced here. Once those are done, we will release 2.1.7 and 2.0.7. -- Trent Jarvi taj at www.linux.org.uk From no_spam at somewhere.com Tue Apr 5 11:55:37 2005 From: no_spam at somewhere.com (no_spam@somewhere.com) Date: Tue, 5 Apr 2005 13:55:37 -0400 Subject: [Rxtx] Closing a port from an event listener results in a deadlock Message-ID: <20050405175537.GA21747@rcog.homelinux.net> On the message I sent on March 14, does anyone had the chance to try the modification? Or was it already fixed? (I haven't searched the archive extensively) Or maybe my message got catched by some spam filters? (it made it to the list archive though) Anyway, I would appreciate some feedback (through the list) Thanks From taj at www.linux.org.uk Tue Apr 5 14:42:28 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 21:42:28 +0100 (BST) Subject: [Rxtx] Closing a port from an event listener results in a deadlock In-Reply-To: <20050405175537.GA21747@rcog.homelinux.net> References: <20050405175537.GA21747@rcog.homelinux.net> Message-ID: On Tue, 5 Apr 2005 no_spam at somewhere.com wrote: > On the message I sent on March 14, does anyone had the chance to try the > modification? > > Or was it already fixed? (I haven't searched the archive extensively) > > Or maybe my message got catched by some spam filters? (it made it to the list > archive though) > > Anyway, I would appreciate some feedback (through the list) > The patch is here http://marc.theaimsgroup.com/?l=rxtx&m=111084488820288&w=2 I have applied this patch to a local copy but will not be doing formal testing for a couple weeks. I do not try to close ports from inside the eventListenter usually so I encourage any feedback also. If there are no problems reported, I expect this will go into rxtx 2.1-7. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Wed Apr 6 08:33:42 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Wed, 06 Apr 2005 15:33:42 +0100 Subject: [Rxtx] getting RXTX version Message-ID: <4253F346.50102@emation.pt> Hi, I want to make sure my deployments have the same version of RXTX jar and native lib. I know the version of the jar can be obtained in the Version class, but how can I obtain the native version ? I know RXTX prints to the console a warning if the version is different. Is there a way to programatically know is this is the case ? I would like to log that to our app's log thanks Ricardo From taj at www.linux.org.uk Wed Apr 6 15:10:20 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 6 Apr 2005 22:10:20 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4253F346.50102@emation.pt> References: <4253F346.50102@emation.pt> Message-ID: On Wed, 6 Apr 2005, Ricardo Trindade wrote: > Hi, > > I want to make sure my deployments have the same version of RXTX jar > and native lib. > > I know the version of the jar can be obtained in the Version class, > but how can I obtain the native version ? > > I know RXTX prints to the console a warning if the version is > different. Is there a way to programatically know is this is the case ? > > I would like to log that to our app's log > There isn't a suggested way of doing that right now. We could move things around and have a static String RXTXVersion.getNativeVersion() in future releases. Is this what you expected? This is not documented in commapi at all. I just tossed that in to catch conflicts while developing. It would be nice to have access in GUI applications though. It may be possible to access RXTXCommDriver.LibVersion right now. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Thu Apr 7 02:51:00 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 09:51:00 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> Message-ID: <4254F474.7020905@emation.pt> >There isn't a suggested way of doing that right now. We could move things >around and have a static String RXTXVersion.getNativeVersion() in future >releases. Is this what you expected? > > Yes, that would be perfect. >This is not documented in commapi at all. I just tossed that in to catch >conflicts while developing. It would be nice to have access in GUI >applications though. > >It may be possible to access RXTXCommDriver.LibVersion right now. > > > I tried, and I don't think it's possible. From taj at www.linux.org.uk Thu Apr 7 03:32:04 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 7 Apr 2005 10:32:04 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4254F474.7020905@emation.pt> References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: On Thu, 7 Apr 2005, Ricardo Trindade wrote: > > >There isn't a suggested way of doing that right now. We could move things > >around and have a static String RXTXVersion.getNativeVersion() in future > >releases. Is this what you expected? > > > > > > Yes, that would be perfect. > The attached should do what you want. You will still need to catch an exception for older versions... -- Trent Jarvi taj at www.linux.org.uk -------------- next part -------------- ? public_version.patch Index: RXTXCommDriver.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXCommDriver.java,v retrieving revision 1.16.2.51 diff -u -r1.16.2.51 RXTXCommDriver.java --- RXTXCommDriver.java 12 Oct 2004 09:13:30 -0000 1.16.2.51 +++ RXTXCommDriver.java 7 Apr 2005 09:29:04 -0000 @@ -54,7 +54,7 @@ the Library. */ String JarVersion = RXTXVersion.getVersion(); - String LibVersion = nativeGetVersion(); + String LibVersion = RXTXVersion.nativeGetVersion(); if ( devel ) { System.out.println("Devel Library"); @@ -76,7 +76,6 @@ /** Get the Serial port prefixes for the running OS */ private String deviceDirectory; private String osName; - private static native String nativeGetVersion(); private native boolean registerKnownPorts(int PortType); private native boolean isPortPrefixValid(String dev); private native boolean testRead(String dev, int type); Index: RXTXVersion.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXVersion.java,v retrieving revision 1.2.2.31 diff -u -r1.2.2.31 RXTXVersion.java --- RXTXVersion.java 16 Oct 2004 16:20:35 -0000 1.2.2.31 +++ RXTXVersion.java 7 Apr 2005 09:29:04 -0000 @@ -36,6 +36,7 @@ private static String Version; static { + System.loadLibrary( "rxtxSerial" ); Version = "RXTX-2.1-7pre20"; } /** @@ -47,4 +48,5 @@ { return(Version); } + public static native String nativeGetVersion(); } Index: SerialImp.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v retrieving revision 1.46.2.181 diff -u -r1.46.2.181 SerialImp.c --- SerialImp.c 17 Oct 2004 09:48:56 -0000 1.46.2.181 +++ SerialImp.c 7 Apr 2005 09:29:07 -0000 @@ -116,6 +116,7 @@ * It will eventually be removed. * */ #define RXTXPort(foo) Java_gnu_io_RXTXPort_ ## foo +#define RXTXVersion(foo) Java_gnu_io_RXTXVersion_ ## foo #define RXTXCommDriver(foo) Java_gnu_io_RXTXCommDriver_ ## foo #if defined(__sun__) || defined(__hpux__) @@ -4001,7 +4002,7 @@ } /*---------------------------------------------------------- -RXTXCommDriver.nativeGetVersion +RXTXVersion.nativeGetVersion accept: none perform: return the current version @@ -4010,9 +4011,10 @@ comments: This is used to avoid mixing versions of the .jar and native library. First introduced in rxtx-1.5-9 + Moved from RXTXCommDriver to RXTXVersion in rxtx-2.1-7 ----------------------------------------------------------*/ -JNIEXPORT jstring JNICALL RXTXCommDriver(nativeGetVersion) (JNIEnv *env, +JNIEXPORT jstring JNICALL RXTXVersion(nativeGetVersion) (JNIEnv *env, jclass jclazz ) { return (*env)->NewStringUTF( env, "RXTX-2.1-7pre20" ); From ricardo.trindade at emation.pt Thu Apr 7 03:45:58 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 10:45:58 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: <42550156.2040908@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050407/05212451/attachment-0055.html From thomas.shulok at lmco.com Thu Apr 7 17:43:11 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Thu, 07 Apr 2005 19:43:11 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi There, I'm attempting to talk RS232 between an embedded Linux box and a Windows box. Everything connects up fine, and I can send and receive a simple sequence of bytes with no problems. However, if around 5 seconds goes by without me sending something, I get the following when I attempt to send. java.io.IOException: Input/output error in writeArray Stack trace: java/lang/Throwable.()V java/lang/Throwable.(Ljava/lang/String;)V java/io/IOException.(Ljava/lang/String;)V gnu/io/RXTXPort.writeArray([BIIZ)V gnu/io/RXTXPort$SerialOutputStream.write([B)V SerialTest.main([Ljava/lang/String;)V If there interval is shorter (say 2 seconds between sends), I have no problems. On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and librxtxSerial-2.0.7pre2.so. Any ideas? Thanks, Thom -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5b23dcf/attachment-0055.html From taj at www.linux.org.uk Thu Apr 7 19:22:36 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:22:36 +0100 (BST) Subject: [Rxtx] Input/output error in writeArray In-Reply-To: References: Message-ID: On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a Windows > box. Everything connects up fine, and I can send and receive a simple > sequence of bytes with no problems. However, if around 5 seconds goes > by without me sending something, I get the following when I attempt to > send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Apr 7 19:24:59 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:24:59 +0100 (BST) Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) Message-ID: hmm. This would not work from applets would it? -- Trent Jarvi taj at www.linux.org.uk ---------- Forwarded message ---------- Date: Thu, 07 Apr 2005 16:05:53 -0400 From: Chris Gaffney To: taj at www.linux.org.uk Subject: RXTX Libraries on Classpath fix Hi, I submitted a patch for RXTX a few weeks ago to allow for loading the native libraries from the classpath. Since sending it to you I found it wasn't working on windows. I've fixed the problem and created a new patch that should replace the older one. The actual change is a one line from a String.equals() to a String.startsWith(). Thanks for a great piece of software, -Chris Gaffney Grand Valley State University -------------- next part -------------- A non-text attachment was scrubbed... Name: libraries_on_classpath_fixed.patch Type: text/x-patch Size: 5617 bytes Desc: Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5d423b8/libraries_on_classpath_fixed-0055.bin From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From thomas.shulok at lmco.com Fri Apr 8 10:38:55 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Fri, 08 Apr 2005 12:38:55 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi Trent, Thanks for the prompt response. Before diving deeper, I was wondering if there is a timeout parameter somewhere in the stack that I have not set properly. Given the nature of the failure (only fails if the line has been idle for a few seconds), it feels like some kind of timeout issue... Thanks again, Thom -----Original Message----- From: rxtx-bounces at mail.linuxgrrls.org [mailto:rxtx-bounces at mail.linuxgrrls.org] On Behalf Of Trent Jarvi Sent: Thursday, April 07, 2005 6:23 PM To: Java RXTX discussion Subject: Re: [Rxtx] Input/output error in writeArray On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a > Windows box. Everything connects up fine, and I can send and receive > a simple sequence of bytes with no problems. However, if around 5 > seconds goes by without me sending something, I get the following when > I attempt to send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at mail.linuxgrrls.org http://mail.linuxgrrls.org/mailman/listinfo/rxtx From ricardo.trindade at emation.pt Mon Apr 4 09:17:23 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Mon, 04 Apr 2005 16:17:23 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot Message-ID: <42515A83.4050907@emation.pt> Hi, I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most recent stable snapshot), and get the following exception : It looks like rxtx has been compiled with jdk 1.5. If this was indeed the case, I think there is a compilation flag that generates code that runs on older jdks. java.lang.UnsupportedClassVersionError: gnu/io/UnsupportedCommOperationException (Unsupported major.minor version 49.0) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at java.net.URLClassLoader.defineClass(URLClassLoader.java:251) at java.net.URLClassLoader.access$100(URLClassLoader.java:55) at java.net.URLClassLoader$1.run(URLClassLoader.java:194) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:187) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:141) I'm trying to run it with 1.4. thanks Ricardo From taj at www.linux.org.uk Tue Apr 5 00:48:12 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 07:48:12 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42515A83.4050907@emation.pt> References: <42515A83.4050907@emation.pt> Message-ID: On Mon, 4 Apr 2005, Ricardo Trindade wrote: > Hi, > > I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most > recent stable snapshot), and get the following exception : > > It looks like rxtx has been compiled with jdk 1.5. If this was > indeed the case, I think there is a compilation flag that generates code > that runs on older jdks. > > java.lang.UnsupportedClassVersionError: > gnu/io/UnsupportedCommOperationException (Unsupported major.minor > version 49.0) [snip] Thanks Ricardo I recompiled the jar with javac -source 1.3 -target 1.3. That should cover most of the JRE's in use today. I also compiled the rxtx 2.0 x86_64 native library which appeared to be missing. I tried looking for flags to pass gcc 4.0 to make the native libraries more backwards compatible but only found options for C++ which is not used in rxtx. I've got a list of other bugs that I'll be going through in the next few weeks but for now I just left them with the same CVS filename - no code changes. ftp://ftp.qbang.org/pub/rxtx/rxtx-2.0-CVS-20050120-bins.tar.gz ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-CVS-20050120-bins.tar.gz -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Tue Apr 5 02:24:33 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 05 Apr 2005 09:24:33 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: References: <42515A83.4050907@emation.pt> Message-ID: <42524B41.3040300@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050405/5919abbb/attachment-0056.html From taj at www.linux.org.uk Tue Apr 5 03:00:29 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 10:00:29 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42524B41.3040300@emation.pt> References: <42515A83.4050907@emation.pt> <42524B41.3040300@emation.pt> Message-ID: On Tue, 5 Apr 2005, Ricardo Trindade wrote: > Will you anounce to the list when a new release is available ? > There will be several incremental releases announced here. Once those are done, we will release 2.1.7 and 2.0.7. -- Trent Jarvi taj at www.linux.org.uk From no_spam at somewhere.com Tue Apr 5 11:55:37 2005 From: no_spam at somewhere.com (no_spam@somewhere.com) Date: Tue, 5 Apr 2005 13:55:37 -0400 Subject: [Rxtx] Closing a port from an event listener results in a deadlock Message-ID: <20050405175537.GA21747@rcog.homelinux.net> On the message I sent on March 14, does anyone had the chance to try the modification? Or was it already fixed? (I haven't searched the archive extensively) Or maybe my message got catched by some spam filters? (it made it to the list archive though) Anyway, I would appreciate some feedback (through the list) Thanks From taj at www.linux.org.uk Tue Apr 5 14:42:28 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 21:42:28 +0100 (BST) Subject: [Rxtx] Closing a port from an event listener results in a deadlock In-Reply-To: <20050405175537.GA21747@rcog.homelinux.net> References: <20050405175537.GA21747@rcog.homelinux.net> Message-ID: On Tue, 5 Apr 2005 no_spam at somewhere.com wrote: > On the message I sent on March 14, does anyone had the chance to try the > modification? > > Or was it already fixed? (I haven't searched the archive extensively) > > Or maybe my message got catched by some spam filters? (it made it to the list > archive though) > > Anyway, I would appreciate some feedback (through the list) > The patch is here http://marc.theaimsgroup.com/?l=rxtx&m=111084488820288&w=2 I have applied this patch to a local copy but will not be doing formal testing for a couple weeks. I do not try to close ports from inside the eventListenter usually so I encourage any feedback also. If there are no problems reported, I expect this will go into rxtx 2.1-7. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Wed Apr 6 08:33:42 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Wed, 06 Apr 2005 15:33:42 +0100 Subject: [Rxtx] getting RXTX version Message-ID: <4253F346.50102@emation.pt> Hi, I want to make sure my deployments have the same version of RXTX jar and native lib. I know the version of the jar can be obtained in the Version class, but how can I obtain the native version ? I know RXTX prints to the console a warning if the version is different. Is there a way to programatically know is this is the case ? I would like to log that to our app's log thanks Ricardo From taj at www.linux.org.uk Wed Apr 6 15:10:20 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 6 Apr 2005 22:10:20 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4253F346.50102@emation.pt> References: <4253F346.50102@emation.pt> Message-ID: On Wed, 6 Apr 2005, Ricardo Trindade wrote: > Hi, > > I want to make sure my deployments have the same version of RXTX jar > and native lib. > > I know the version of the jar can be obtained in the Version class, > but how can I obtain the native version ? > > I know RXTX prints to the console a warning if the version is > different. Is there a way to programatically know is this is the case ? > > I would like to log that to our app's log > There isn't a suggested way of doing that right now. We could move things around and have a static String RXTXVersion.getNativeVersion() in future releases. Is this what you expected? This is not documented in commapi at all. I just tossed that in to catch conflicts while developing. It would be nice to have access in GUI applications though. It may be possible to access RXTXCommDriver.LibVersion right now. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Thu Apr 7 02:51:00 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 09:51:00 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> Message-ID: <4254F474.7020905@emation.pt> >There isn't a suggested way of doing that right now. We could move things >around and have a static String RXTXVersion.getNativeVersion() in future >releases. Is this what you expected? > > Yes, that would be perfect. >This is not documented in commapi at all. I just tossed that in to catch >conflicts while developing. It would be nice to have access in GUI >applications though. > >It may be possible to access RXTXCommDriver.LibVersion right now. > > > I tried, and I don't think it's possible. From taj at www.linux.org.uk Thu Apr 7 03:32:04 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 7 Apr 2005 10:32:04 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4254F474.7020905@emation.pt> References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: On Thu, 7 Apr 2005, Ricardo Trindade wrote: > > >There isn't a suggested way of doing that right now. We could move things > >around and have a static String RXTXVersion.getNativeVersion() in future > >releases. Is this what you expected? > > > > > > Yes, that would be perfect. > The attached should do what you want. You will still need to catch an exception for older versions... -- Trent Jarvi taj at www.linux.org.uk -------------- next part -------------- ? public_version.patch Index: RXTXCommDriver.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXCommDriver.java,v retrieving revision 1.16.2.51 diff -u -r1.16.2.51 RXTXCommDriver.java --- RXTXCommDriver.java 12 Oct 2004 09:13:30 -0000 1.16.2.51 +++ RXTXCommDriver.java 7 Apr 2005 09:29:04 -0000 @@ -54,7 +54,7 @@ the Library. */ String JarVersion = RXTXVersion.getVersion(); - String LibVersion = nativeGetVersion(); + String LibVersion = RXTXVersion.nativeGetVersion(); if ( devel ) { System.out.println("Devel Library"); @@ -76,7 +76,6 @@ /** Get the Serial port prefixes for the running OS */ private String deviceDirectory; private String osName; - private static native String nativeGetVersion(); private native boolean registerKnownPorts(int PortType); private native boolean isPortPrefixValid(String dev); private native boolean testRead(String dev, int type); Index: RXTXVersion.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXVersion.java,v retrieving revision 1.2.2.31 diff -u -r1.2.2.31 RXTXVersion.java --- RXTXVersion.java 16 Oct 2004 16:20:35 -0000 1.2.2.31 +++ RXTXVersion.java 7 Apr 2005 09:29:04 -0000 @@ -36,6 +36,7 @@ private static String Version; static { + System.loadLibrary( "rxtxSerial" ); Version = "RXTX-2.1-7pre20"; } /** @@ -47,4 +48,5 @@ { return(Version); } + public static native String nativeGetVersion(); } Index: SerialImp.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v retrieving revision 1.46.2.181 diff -u -r1.46.2.181 SerialImp.c --- SerialImp.c 17 Oct 2004 09:48:56 -0000 1.46.2.181 +++ SerialImp.c 7 Apr 2005 09:29:07 -0000 @@ -116,6 +116,7 @@ * It will eventually be removed. * */ #define RXTXPort(foo) Java_gnu_io_RXTXPort_ ## foo +#define RXTXVersion(foo) Java_gnu_io_RXTXVersion_ ## foo #define RXTXCommDriver(foo) Java_gnu_io_RXTXCommDriver_ ## foo #if defined(__sun__) || defined(__hpux__) @@ -4001,7 +4002,7 @@ } /*---------------------------------------------------------- -RXTXCommDriver.nativeGetVersion +RXTXVersion.nativeGetVersion accept: none perform: return the current version @@ -4010,9 +4011,10 @@ comments: This is used to avoid mixing versions of the .jar and native library. First introduced in rxtx-1.5-9 + Moved from RXTXCommDriver to RXTXVersion in rxtx-2.1-7 ----------------------------------------------------------*/ -JNIEXPORT jstring JNICALL RXTXCommDriver(nativeGetVersion) (JNIEnv *env, +JNIEXPORT jstring JNICALL RXTXVersion(nativeGetVersion) (JNIEnv *env, jclass jclazz ) { return (*env)->NewStringUTF( env, "RXTX-2.1-7pre20" ); From ricardo.trindade at emation.pt Thu Apr 7 03:45:58 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 10:45:58 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: <42550156.2040908@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050407/05212451/attachment-0056.html From thomas.shulok at lmco.com Thu Apr 7 17:43:11 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Thu, 07 Apr 2005 19:43:11 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi There, I'm attempting to talk RS232 between an embedded Linux box and a Windows box. Everything connects up fine, and I can send and receive a simple sequence of bytes with no problems. However, if around 5 seconds goes by without me sending something, I get the following when I attempt to send. java.io.IOException: Input/output error in writeArray Stack trace: java/lang/Throwable.()V java/lang/Throwable.(Ljava/lang/String;)V java/io/IOException.(Ljava/lang/String;)V gnu/io/RXTXPort.writeArray([BIIZ)V gnu/io/RXTXPort$SerialOutputStream.write([B)V SerialTest.main([Ljava/lang/String;)V If there interval is shorter (say 2 seconds between sends), I have no problems. On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and librxtxSerial-2.0.7pre2.so. Any ideas? Thanks, Thom -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5b23dcf/attachment-0056.html From taj at www.linux.org.uk Thu Apr 7 19:22:36 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:22:36 +0100 (BST) Subject: [Rxtx] Input/output error in writeArray In-Reply-To: References: Message-ID: On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a Windows > box. Everything connects up fine, and I can send and receive a simple > sequence of bytes with no problems. However, if around 5 seconds goes > by without me sending something, I get the following when I attempt to > send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Apr 7 19:24:59 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:24:59 +0100 (BST) Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) Message-ID: hmm. This would not work from applets would it? -- Trent Jarvi taj at www.linux.org.uk ---------- Forwarded message ---------- Date: Thu, 07 Apr 2005 16:05:53 -0400 From: Chris Gaffney To: taj at www.linux.org.uk Subject: RXTX Libraries on Classpath fix Hi, I submitted a patch for RXTX a few weeks ago to allow for loading the native libraries from the classpath. Since sending it to you I found it wasn't working on windows. I've fixed the problem and created a new patch that should replace the older one. The actual change is a one line from a String.equals() to a String.startsWith(). Thanks for a great piece of software, -Chris Gaffney Grand Valley State University -------------- next part -------------- A non-text attachment was scrubbed... Name: libraries_on_classpath_fixed.patch Type: text/x-patch Size: 5617 bytes Desc: Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5d423b8/libraries_on_classpath_fixed-0056.bin From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From thomas.shulok at lmco.com Fri Apr 8 10:38:55 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Fri, 08 Apr 2005 12:38:55 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi Trent, Thanks for the prompt response. Before diving deeper, I was wondering if there is a timeout parameter somewhere in the stack that I have not set properly. Given the nature of the failure (only fails if the line has been idle for a few seconds), it feels like some kind of timeout issue... Thanks again, Thom -----Original Message----- From: rxtx-bounces at mail.linuxgrrls.org [mailto:rxtx-bounces at mail.linuxgrrls.org] On Behalf Of Trent Jarvi Sent: Thursday, April 07, 2005 6:23 PM To: Java RXTX discussion Subject: Re: [Rxtx] Input/output error in writeArray On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a > Windows box. Everything connects up fine, and I can send and receive > a simple sequence of bytes with no problems. However, if around 5 > seconds goes by without me sending something, I get the following when > I attempt to send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at mail.linuxgrrls.org http://mail.linuxgrrls.org/mailman/listinfo/rxtx From ricardo.trindade at emation.pt Mon Apr 4 09:17:23 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Mon, 04 Apr 2005 16:17:23 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot Message-ID: <42515A83.4050907@emation.pt> Hi, I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most recent stable snapshot), and get the following exception : It looks like rxtx has been compiled with jdk 1.5. If this was indeed the case, I think there is a compilation flag that generates code that runs on older jdks. java.lang.UnsupportedClassVersionError: gnu/io/UnsupportedCommOperationException (Unsupported major.minor version 49.0) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at java.net.URLClassLoader.defineClass(URLClassLoader.java:251) at java.net.URLClassLoader.access$100(URLClassLoader.java:55) at java.net.URLClassLoader$1.run(URLClassLoader.java:194) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:187) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:141) I'm trying to run it with 1.4. thanks Ricardo From taj at www.linux.org.uk Tue Apr 5 00:48:12 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 07:48:12 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42515A83.4050907@emation.pt> References: <42515A83.4050907@emation.pt> Message-ID: On Mon, 4 Apr 2005, Ricardo Trindade wrote: > Hi, > > I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most > recent stable snapshot), and get the following exception : > > It looks like rxtx has been compiled with jdk 1.5. If this was > indeed the case, I think there is a compilation flag that generates code > that runs on older jdks. > > java.lang.UnsupportedClassVersionError: > gnu/io/UnsupportedCommOperationException (Unsupported major.minor > version 49.0) [snip] Thanks Ricardo I recompiled the jar with javac -source 1.3 -target 1.3. That should cover most of the JRE's in use today. I also compiled the rxtx 2.0 x86_64 native library which appeared to be missing. I tried looking for flags to pass gcc 4.0 to make the native libraries more backwards compatible but only found options for C++ which is not used in rxtx. I've got a list of other bugs that I'll be going through in the next few weeks but for now I just left them with the same CVS filename - no code changes. ftp://ftp.qbang.org/pub/rxtx/rxtx-2.0-CVS-20050120-bins.tar.gz ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-CVS-20050120-bins.tar.gz -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Tue Apr 5 02:24:33 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 05 Apr 2005 09:24:33 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: References: <42515A83.4050907@emation.pt> Message-ID: <42524B41.3040300@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050405/5919abbb/attachment-0057.html From taj at www.linux.org.uk Tue Apr 5 03:00:29 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 10:00:29 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42524B41.3040300@emation.pt> References: <42515A83.4050907@emation.pt> <42524B41.3040300@emation.pt> Message-ID: On Tue, 5 Apr 2005, Ricardo Trindade wrote: > Will you anounce to the list when a new release is available ? > There will be several incremental releases announced here. Once those are done, we will release 2.1.7 and 2.0.7. -- Trent Jarvi taj at www.linux.org.uk From no_spam at somewhere.com Tue Apr 5 11:55:37 2005 From: no_spam at somewhere.com (no_spam@somewhere.com) Date: Tue, 5 Apr 2005 13:55:37 -0400 Subject: [Rxtx] Closing a port from an event listener results in a deadlock Message-ID: <20050405175537.GA21747@rcog.homelinux.net> On the message I sent on March 14, does anyone had the chance to try the modification? Or was it already fixed? (I haven't searched the archive extensively) Or maybe my message got catched by some spam filters? (it made it to the list archive though) Anyway, I would appreciate some feedback (through the list) Thanks From taj at www.linux.org.uk Tue Apr 5 14:42:28 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 21:42:28 +0100 (BST) Subject: [Rxtx] Closing a port from an event listener results in a deadlock In-Reply-To: <20050405175537.GA21747@rcog.homelinux.net> References: <20050405175537.GA21747@rcog.homelinux.net> Message-ID: On Tue, 5 Apr 2005 no_spam at somewhere.com wrote: > On the message I sent on March 14, does anyone had the chance to try the > modification? > > Or was it already fixed? (I haven't searched the archive extensively) > > Or maybe my message got catched by some spam filters? (it made it to the list > archive though) > > Anyway, I would appreciate some feedback (through the list) > The patch is here http://marc.theaimsgroup.com/?l=rxtx&m=111084488820288&w=2 I have applied this patch to a local copy but will not be doing formal testing for a couple weeks. I do not try to close ports from inside the eventListenter usually so I encourage any feedback also. If there are no problems reported, I expect this will go into rxtx 2.1-7. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Wed Apr 6 08:33:42 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Wed, 06 Apr 2005 15:33:42 +0100 Subject: [Rxtx] getting RXTX version Message-ID: <4253F346.50102@emation.pt> Hi, I want to make sure my deployments have the same version of RXTX jar and native lib. I know the version of the jar can be obtained in the Version class, but how can I obtain the native version ? I know RXTX prints to the console a warning if the version is different. Is there a way to programatically know is this is the case ? I would like to log that to our app's log thanks Ricardo From taj at www.linux.org.uk Wed Apr 6 15:10:20 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 6 Apr 2005 22:10:20 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4253F346.50102@emation.pt> References: <4253F346.50102@emation.pt> Message-ID: On Wed, 6 Apr 2005, Ricardo Trindade wrote: > Hi, > > I want to make sure my deployments have the same version of RXTX jar > and native lib. > > I know the version of the jar can be obtained in the Version class, > but how can I obtain the native version ? > > I know RXTX prints to the console a warning if the version is > different. Is there a way to programatically know is this is the case ? > > I would like to log that to our app's log > There isn't a suggested way of doing that right now. We could move things around and have a static String RXTXVersion.getNativeVersion() in future releases. Is this what you expected? This is not documented in commapi at all. I just tossed that in to catch conflicts while developing. It would be nice to have access in GUI applications though. It may be possible to access RXTXCommDriver.LibVersion right now. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Thu Apr 7 02:51:00 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 09:51:00 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> Message-ID: <4254F474.7020905@emation.pt> >There isn't a suggested way of doing that right now. We could move things >around and have a static String RXTXVersion.getNativeVersion() in future >releases. Is this what you expected? > > Yes, that would be perfect. >This is not documented in commapi at all. I just tossed that in to catch >conflicts while developing. It would be nice to have access in GUI >applications though. > >It may be possible to access RXTXCommDriver.LibVersion right now. > > > I tried, and I don't think it's possible. From taj at www.linux.org.uk Thu Apr 7 03:32:04 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 7 Apr 2005 10:32:04 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4254F474.7020905@emation.pt> References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: On Thu, 7 Apr 2005, Ricardo Trindade wrote: > > >There isn't a suggested way of doing that right now. We could move things > >around and have a static String RXTXVersion.getNativeVersion() in future > >releases. Is this what you expected? > > > > > > Yes, that would be perfect. > The attached should do what you want. You will still need to catch an exception for older versions... -- Trent Jarvi taj at www.linux.org.uk -------------- next part -------------- ? public_version.patch Index: RXTXCommDriver.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXCommDriver.java,v retrieving revision 1.16.2.51 diff -u -r1.16.2.51 RXTXCommDriver.java --- RXTXCommDriver.java 12 Oct 2004 09:13:30 -0000 1.16.2.51 +++ RXTXCommDriver.java 7 Apr 2005 09:29:04 -0000 @@ -54,7 +54,7 @@ the Library. */ String JarVersion = RXTXVersion.getVersion(); - String LibVersion = nativeGetVersion(); + String LibVersion = RXTXVersion.nativeGetVersion(); if ( devel ) { System.out.println("Devel Library"); @@ -76,7 +76,6 @@ /** Get the Serial port prefixes for the running OS */ private String deviceDirectory; private String osName; - private static native String nativeGetVersion(); private native boolean registerKnownPorts(int PortType); private native boolean isPortPrefixValid(String dev); private native boolean testRead(String dev, int type); Index: RXTXVersion.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXVersion.java,v retrieving revision 1.2.2.31 diff -u -r1.2.2.31 RXTXVersion.java --- RXTXVersion.java 16 Oct 2004 16:20:35 -0000 1.2.2.31 +++ RXTXVersion.java 7 Apr 2005 09:29:04 -0000 @@ -36,6 +36,7 @@ private static String Version; static { + System.loadLibrary( "rxtxSerial" ); Version = "RXTX-2.1-7pre20"; } /** @@ -47,4 +48,5 @@ { return(Version); } + public static native String nativeGetVersion(); } Index: SerialImp.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v retrieving revision 1.46.2.181 diff -u -r1.46.2.181 SerialImp.c --- SerialImp.c 17 Oct 2004 09:48:56 -0000 1.46.2.181 +++ SerialImp.c 7 Apr 2005 09:29:07 -0000 @@ -116,6 +116,7 @@ * It will eventually be removed. * */ #define RXTXPort(foo) Java_gnu_io_RXTXPort_ ## foo +#define RXTXVersion(foo) Java_gnu_io_RXTXVersion_ ## foo #define RXTXCommDriver(foo) Java_gnu_io_RXTXCommDriver_ ## foo #if defined(__sun__) || defined(__hpux__) @@ -4001,7 +4002,7 @@ } /*---------------------------------------------------------- -RXTXCommDriver.nativeGetVersion +RXTXVersion.nativeGetVersion accept: none perform: return the current version @@ -4010,9 +4011,10 @@ comments: This is used to avoid mixing versions of the .jar and native library. First introduced in rxtx-1.5-9 + Moved from RXTXCommDriver to RXTXVersion in rxtx-2.1-7 ----------------------------------------------------------*/ -JNIEXPORT jstring JNICALL RXTXCommDriver(nativeGetVersion) (JNIEnv *env, +JNIEXPORT jstring JNICALL RXTXVersion(nativeGetVersion) (JNIEnv *env, jclass jclazz ) { return (*env)->NewStringUTF( env, "RXTX-2.1-7pre20" ); From ricardo.trindade at emation.pt Thu Apr 7 03:45:58 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 10:45:58 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: <42550156.2040908@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050407/05212451/attachment-0057.html From thomas.shulok at lmco.com Thu Apr 7 17:43:11 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Thu, 07 Apr 2005 19:43:11 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi There, I'm attempting to talk RS232 between an embedded Linux box and a Windows box. Everything connects up fine, and I can send and receive a simple sequence of bytes with no problems. However, if around 5 seconds goes by without me sending something, I get the following when I attempt to send. java.io.IOException: Input/output error in writeArray Stack trace: java/lang/Throwable.()V java/lang/Throwable.(Ljava/lang/String;)V java/io/IOException.(Ljava/lang/String;)V gnu/io/RXTXPort.writeArray([BIIZ)V gnu/io/RXTXPort$SerialOutputStream.write([B)V SerialTest.main([Ljava/lang/String;)V If there interval is shorter (say 2 seconds between sends), I have no problems. On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and librxtxSerial-2.0.7pre2.so. Any ideas? Thanks, Thom -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5b23dcf/attachment-0057.html From taj at www.linux.org.uk Thu Apr 7 19:22:36 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:22:36 +0100 (BST) Subject: [Rxtx] Input/output error in writeArray In-Reply-To: References: Message-ID: On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a Windows > box. Everything connects up fine, and I can send and receive a simple > sequence of bytes with no problems. However, if around 5 seconds goes > by without me sending something, I get the following when I attempt to > send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Apr 7 19:24:59 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:24:59 +0100 (BST) Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) Message-ID: hmm. This would not work from applets would it? -- Trent Jarvi taj at www.linux.org.uk ---------- Forwarded message ---------- Date: Thu, 07 Apr 2005 16:05:53 -0400 From: Chris Gaffney To: taj at www.linux.org.uk Subject: RXTX Libraries on Classpath fix Hi, I submitted a patch for RXTX a few weeks ago to allow for loading the native libraries from the classpath. Since sending it to you I found it wasn't working on windows. I've fixed the problem and created a new patch that should replace the older one. The actual change is a one line from a String.equals() to a String.startsWith(). Thanks for a great piece of software, -Chris Gaffney Grand Valley State University -------------- next part -------------- A non-text attachment was scrubbed... Name: libraries_on_classpath_fixed.patch Type: text/x-patch Size: 5617 bytes Desc: Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5d423b8/libraries_on_classpath_fixed-0057.bin From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From thomas.shulok at lmco.com Fri Apr 8 10:38:55 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Fri, 08 Apr 2005 12:38:55 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi Trent, Thanks for the prompt response. Before diving deeper, I was wondering if there is a timeout parameter somewhere in the stack that I have not set properly. Given the nature of the failure (only fails if the line has been idle for a few seconds), it feels like some kind of timeout issue... Thanks again, Thom -----Original Message----- From: rxtx-bounces at mail.linuxgrrls.org [mailto:rxtx-bounces at mail.linuxgrrls.org] On Behalf Of Trent Jarvi Sent: Thursday, April 07, 2005 6:23 PM To: Java RXTX discussion Subject: Re: [Rxtx] Input/output error in writeArray On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a > Windows box. Everything connects up fine, and I can send and receive > a simple sequence of bytes with no problems. However, if around 5 > seconds goes by without me sending something, I get the following when > I attempt to send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at mail.linuxgrrls.org http://mail.linuxgrrls.org/mailman/listinfo/rxtx From ricardo.trindade at emation.pt Mon Apr 4 09:17:23 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Mon, 04 Apr 2005 16:17:23 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot Message-ID: <42515A83.4050907@emation.pt> Hi, I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most recent stable snapshot), and get the following exception : It looks like rxtx has been compiled with jdk 1.5. If this was indeed the case, I think there is a compilation flag that generates code that runs on older jdks. java.lang.UnsupportedClassVersionError: gnu/io/UnsupportedCommOperationException (Unsupported major.minor version 49.0) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at java.net.URLClassLoader.defineClass(URLClassLoader.java:251) at java.net.URLClassLoader.access$100(URLClassLoader.java:55) at java.net.URLClassLoader$1.run(URLClassLoader.java:194) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:187) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:141) I'm trying to run it with 1.4. thanks Ricardo From taj at www.linux.org.uk Tue Apr 5 00:48:12 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 07:48:12 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42515A83.4050907@emation.pt> References: <42515A83.4050907@emation.pt> Message-ID: On Mon, 4 Apr 2005, Ricardo Trindade wrote: > Hi, > > I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most > recent stable snapshot), and get the following exception : > > It looks like rxtx has been compiled with jdk 1.5. If this was > indeed the case, I think there is a compilation flag that generates code > that runs on older jdks. > > java.lang.UnsupportedClassVersionError: > gnu/io/UnsupportedCommOperationException (Unsupported major.minor > version 49.0) [snip] Thanks Ricardo I recompiled the jar with javac -source 1.3 -target 1.3. That should cover most of the JRE's in use today. I also compiled the rxtx 2.0 x86_64 native library which appeared to be missing. I tried looking for flags to pass gcc 4.0 to make the native libraries more backwards compatible but only found options for C++ which is not used in rxtx. I've got a list of other bugs that I'll be going through in the next few weeks but for now I just left them with the same CVS filename - no code changes. ftp://ftp.qbang.org/pub/rxtx/rxtx-2.0-CVS-20050120-bins.tar.gz ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-CVS-20050120-bins.tar.gz -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Tue Apr 5 02:24:33 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 05 Apr 2005 09:24:33 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: References: <42515A83.4050907@emation.pt> Message-ID: <42524B41.3040300@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050405/5919abbb/attachment-0058.html From taj at www.linux.org.uk Tue Apr 5 03:00:29 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 10:00:29 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42524B41.3040300@emation.pt> References: <42515A83.4050907@emation.pt> <42524B41.3040300@emation.pt> Message-ID: On Tue, 5 Apr 2005, Ricardo Trindade wrote: > Will you anounce to the list when a new release is available ? > There will be several incremental releases announced here. Once those are done, we will release 2.1.7 and 2.0.7. -- Trent Jarvi taj at www.linux.org.uk From no_spam at somewhere.com Tue Apr 5 11:55:37 2005 From: no_spam at somewhere.com (no_spam@somewhere.com) Date: Tue, 5 Apr 2005 13:55:37 -0400 Subject: [Rxtx] Closing a port from an event listener results in a deadlock Message-ID: <20050405175537.GA21747@rcog.homelinux.net> On the message I sent on March 14, does anyone had the chance to try the modification? Or was it already fixed? (I haven't searched the archive extensively) Or maybe my message got catched by some spam filters? (it made it to the list archive though) Anyway, I would appreciate some feedback (through the list) Thanks From taj at www.linux.org.uk Tue Apr 5 14:42:28 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 21:42:28 +0100 (BST) Subject: [Rxtx] Closing a port from an event listener results in a deadlock In-Reply-To: <20050405175537.GA21747@rcog.homelinux.net> References: <20050405175537.GA21747@rcog.homelinux.net> Message-ID: On Tue, 5 Apr 2005 no_spam at somewhere.com wrote: > On the message I sent on March 14, does anyone had the chance to try the > modification? > > Or was it already fixed? (I haven't searched the archive extensively) > > Or maybe my message got catched by some spam filters? (it made it to the list > archive though) > > Anyway, I would appreciate some feedback (through the list) > The patch is here http://marc.theaimsgroup.com/?l=rxtx&m=111084488820288&w=2 I have applied this patch to a local copy but will not be doing formal testing for a couple weeks. I do not try to close ports from inside the eventListenter usually so I encourage any feedback also. If there are no problems reported, I expect this will go into rxtx 2.1-7. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Wed Apr 6 08:33:42 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Wed, 06 Apr 2005 15:33:42 +0100 Subject: [Rxtx] getting RXTX version Message-ID: <4253F346.50102@emation.pt> Hi, I want to make sure my deployments have the same version of RXTX jar and native lib. I know the version of the jar can be obtained in the Version class, but how can I obtain the native version ? I know RXTX prints to the console a warning if the version is different. Is there a way to programatically know is this is the case ? I would like to log that to our app's log thanks Ricardo From taj at www.linux.org.uk Wed Apr 6 15:10:20 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 6 Apr 2005 22:10:20 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4253F346.50102@emation.pt> References: <4253F346.50102@emation.pt> Message-ID: On Wed, 6 Apr 2005, Ricardo Trindade wrote: > Hi, > > I want to make sure my deployments have the same version of RXTX jar > and native lib. > > I know the version of the jar can be obtained in the Version class, > but how can I obtain the native version ? > > I know RXTX prints to the console a warning if the version is > different. Is there a way to programatically know is this is the case ? > > I would like to log that to our app's log > There isn't a suggested way of doing that right now. We could move things around and have a static String RXTXVersion.getNativeVersion() in future releases. Is this what you expected? This is not documented in commapi at all. I just tossed that in to catch conflicts while developing. It would be nice to have access in GUI applications though. It may be possible to access RXTXCommDriver.LibVersion right now. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Thu Apr 7 02:51:00 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 09:51:00 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> Message-ID: <4254F474.7020905@emation.pt> >There isn't a suggested way of doing that right now. We could move things >around and have a static String RXTXVersion.getNativeVersion() in future >releases. Is this what you expected? > > Yes, that would be perfect. >This is not documented in commapi at all. I just tossed that in to catch >conflicts while developing. It would be nice to have access in GUI >applications though. > >It may be possible to access RXTXCommDriver.LibVersion right now. > > > I tried, and I don't think it's possible. From taj at www.linux.org.uk Thu Apr 7 03:32:04 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 7 Apr 2005 10:32:04 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4254F474.7020905@emation.pt> References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: On Thu, 7 Apr 2005, Ricardo Trindade wrote: > > >There isn't a suggested way of doing that right now. We could move things > >around and have a static String RXTXVersion.getNativeVersion() in future > >releases. Is this what you expected? > > > > > > Yes, that would be perfect. > The attached should do what you want. You will still need to catch an exception for older versions... -- Trent Jarvi taj at www.linux.org.uk -------------- next part -------------- ? public_version.patch Index: RXTXCommDriver.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXCommDriver.java,v retrieving revision 1.16.2.51 diff -u -r1.16.2.51 RXTXCommDriver.java --- RXTXCommDriver.java 12 Oct 2004 09:13:30 -0000 1.16.2.51 +++ RXTXCommDriver.java 7 Apr 2005 09:29:04 -0000 @@ -54,7 +54,7 @@ the Library. */ String JarVersion = RXTXVersion.getVersion(); - String LibVersion = nativeGetVersion(); + String LibVersion = RXTXVersion.nativeGetVersion(); if ( devel ) { System.out.println("Devel Library"); @@ -76,7 +76,6 @@ /** Get the Serial port prefixes for the running OS */ private String deviceDirectory; private String osName; - private static native String nativeGetVersion(); private native boolean registerKnownPorts(int PortType); private native boolean isPortPrefixValid(String dev); private native boolean testRead(String dev, int type); Index: RXTXVersion.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXVersion.java,v retrieving revision 1.2.2.31 diff -u -r1.2.2.31 RXTXVersion.java --- RXTXVersion.java 16 Oct 2004 16:20:35 -0000 1.2.2.31 +++ RXTXVersion.java 7 Apr 2005 09:29:04 -0000 @@ -36,6 +36,7 @@ private static String Version; static { + System.loadLibrary( "rxtxSerial" ); Version = "RXTX-2.1-7pre20"; } /** @@ -47,4 +48,5 @@ { return(Version); } + public static native String nativeGetVersion(); } Index: SerialImp.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v retrieving revision 1.46.2.181 diff -u -r1.46.2.181 SerialImp.c --- SerialImp.c 17 Oct 2004 09:48:56 -0000 1.46.2.181 +++ SerialImp.c 7 Apr 2005 09:29:07 -0000 @@ -116,6 +116,7 @@ * It will eventually be removed. * */ #define RXTXPort(foo) Java_gnu_io_RXTXPort_ ## foo +#define RXTXVersion(foo) Java_gnu_io_RXTXVersion_ ## foo #define RXTXCommDriver(foo) Java_gnu_io_RXTXCommDriver_ ## foo #if defined(__sun__) || defined(__hpux__) @@ -4001,7 +4002,7 @@ } /*---------------------------------------------------------- -RXTXCommDriver.nativeGetVersion +RXTXVersion.nativeGetVersion accept: none perform: return the current version @@ -4010,9 +4011,10 @@ comments: This is used to avoid mixing versions of the .jar and native library. First introduced in rxtx-1.5-9 + Moved from RXTXCommDriver to RXTXVersion in rxtx-2.1-7 ----------------------------------------------------------*/ -JNIEXPORT jstring JNICALL RXTXCommDriver(nativeGetVersion) (JNIEnv *env, +JNIEXPORT jstring JNICALL RXTXVersion(nativeGetVersion) (JNIEnv *env, jclass jclazz ) { return (*env)->NewStringUTF( env, "RXTX-2.1-7pre20" ); From ricardo.trindade at emation.pt Thu Apr 7 03:45:58 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 10:45:58 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: <42550156.2040908@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050407/05212451/attachment-0058.html From thomas.shulok at lmco.com Thu Apr 7 17:43:11 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Thu, 07 Apr 2005 19:43:11 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi There, I'm attempting to talk RS232 between an embedded Linux box and a Windows box. Everything connects up fine, and I can send and receive a simple sequence of bytes with no problems. However, if around 5 seconds goes by without me sending something, I get the following when I attempt to send. java.io.IOException: Input/output error in writeArray Stack trace: java/lang/Throwable.()V java/lang/Throwable.(Ljava/lang/String;)V java/io/IOException.(Ljava/lang/String;)V gnu/io/RXTXPort.writeArray([BIIZ)V gnu/io/RXTXPort$SerialOutputStream.write([B)V SerialTest.main([Ljava/lang/String;)V If there interval is shorter (say 2 seconds between sends), I have no problems. On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and librxtxSerial-2.0.7pre2.so. Any ideas? Thanks, Thom -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5b23dcf/attachment-0058.html From taj at www.linux.org.uk Thu Apr 7 19:22:36 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:22:36 +0100 (BST) Subject: [Rxtx] Input/output error in writeArray In-Reply-To: References: Message-ID: On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a Windows > box. Everything connects up fine, and I can send and receive a simple > sequence of bytes with no problems. However, if around 5 seconds goes > by without me sending something, I get the following when I attempt to > send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Apr 7 19:24:59 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:24:59 +0100 (BST) Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) Message-ID: hmm. This would not work from applets would it? -- Trent Jarvi taj at www.linux.org.uk ---------- Forwarded message ---------- Date: Thu, 07 Apr 2005 16:05:53 -0400 From: Chris Gaffney To: taj at www.linux.org.uk Subject: RXTX Libraries on Classpath fix Hi, I submitted a patch for RXTX a few weeks ago to allow for loading the native libraries from the classpath. Since sending it to you I found it wasn't working on windows. I've fixed the problem and created a new patch that should replace the older one. The actual change is a one line from a String.equals() to a String.startsWith(). Thanks for a great piece of software, -Chris Gaffney Grand Valley State University -------------- next part -------------- A non-text attachment was scrubbed... Name: libraries_on_classpath_fixed.patch Type: text/x-patch Size: 5617 bytes Desc: Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5d423b8/libraries_on_classpath_fixed-0058.bin From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From thomas.shulok at lmco.com Fri Apr 8 10:38:55 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Fri, 08 Apr 2005 12:38:55 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi Trent, Thanks for the prompt response. Before diving deeper, I was wondering if there is a timeout parameter somewhere in the stack that I have not set properly. Given the nature of the failure (only fails if the line has been idle for a few seconds), it feels like some kind of timeout issue... Thanks again, Thom -----Original Message----- From: rxtx-bounces at mail.linuxgrrls.org [mailto:rxtx-bounces at mail.linuxgrrls.org] On Behalf Of Trent Jarvi Sent: Thursday, April 07, 2005 6:23 PM To: Java RXTX discussion Subject: Re: [Rxtx] Input/output error in writeArray On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a > Windows box. Everything connects up fine, and I can send and receive > a simple sequence of bytes with no problems. However, if around 5 > seconds goes by without me sending something, I get the following when > I attempt to send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at mail.linuxgrrls.org http://mail.linuxgrrls.org/mailman/listinfo/rxtx From ricardo.trindade at emation.pt Mon Apr 4 09:17:23 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Mon, 04 Apr 2005 16:17:23 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot Message-ID: <42515A83.4050907@emation.pt> Hi, I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most recent stable snapshot), and get the following exception : It looks like rxtx has been compiled with jdk 1.5. If this was indeed the case, I think there is a compilation flag that generates code that runs on older jdks. java.lang.UnsupportedClassVersionError: gnu/io/UnsupportedCommOperationException (Unsupported major.minor version 49.0) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at java.net.URLClassLoader.defineClass(URLClassLoader.java:251) at java.net.URLClassLoader.access$100(URLClassLoader.java:55) at java.net.URLClassLoader$1.run(URLClassLoader.java:194) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:187) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:141) I'm trying to run it with 1.4. thanks Ricardo From taj at www.linux.org.uk Tue Apr 5 00:48:12 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 07:48:12 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42515A83.4050907@emation.pt> References: <42515A83.4050907@emation.pt> Message-ID: On Mon, 4 Apr 2005, Ricardo Trindade wrote: > Hi, > > I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most > recent stable snapshot), and get the following exception : > > It looks like rxtx has been compiled with jdk 1.5. If this was > indeed the case, I think there is a compilation flag that generates code > that runs on older jdks. > > java.lang.UnsupportedClassVersionError: > gnu/io/UnsupportedCommOperationException (Unsupported major.minor > version 49.0) [snip] Thanks Ricardo I recompiled the jar with javac -source 1.3 -target 1.3. That should cover most of the JRE's in use today. I also compiled the rxtx 2.0 x86_64 native library which appeared to be missing. I tried looking for flags to pass gcc 4.0 to make the native libraries more backwards compatible but only found options for C++ which is not used in rxtx. I've got a list of other bugs that I'll be going through in the next few weeks but for now I just left them with the same CVS filename - no code changes. ftp://ftp.qbang.org/pub/rxtx/rxtx-2.0-CVS-20050120-bins.tar.gz ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-CVS-20050120-bins.tar.gz -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Tue Apr 5 02:24:33 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 05 Apr 2005 09:24:33 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: References: <42515A83.4050907@emation.pt> Message-ID: <42524B41.3040300@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050405/5919abbb/attachment-0059.html From taj at www.linux.org.uk Tue Apr 5 03:00:29 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 10:00:29 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42524B41.3040300@emation.pt> References: <42515A83.4050907@emation.pt> <42524B41.3040300@emation.pt> Message-ID: On Tue, 5 Apr 2005, Ricardo Trindade wrote: > Will you anounce to the list when a new release is available ? > There will be several incremental releases announced here. Once those are done, we will release 2.1.7 and 2.0.7. -- Trent Jarvi taj at www.linux.org.uk From no_spam at somewhere.com Tue Apr 5 11:55:37 2005 From: no_spam at somewhere.com (no_spam@somewhere.com) Date: Tue, 5 Apr 2005 13:55:37 -0400 Subject: [Rxtx] Closing a port from an event listener results in a deadlock Message-ID: <20050405175537.GA21747@rcog.homelinux.net> On the message I sent on March 14, does anyone had the chance to try the modification? Or was it already fixed? (I haven't searched the archive extensively) Or maybe my message got catched by some spam filters? (it made it to the list archive though) Anyway, I would appreciate some feedback (through the list) Thanks From taj at www.linux.org.uk Tue Apr 5 14:42:28 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 21:42:28 +0100 (BST) Subject: [Rxtx] Closing a port from an event listener results in a deadlock In-Reply-To: <20050405175537.GA21747@rcog.homelinux.net> References: <20050405175537.GA21747@rcog.homelinux.net> Message-ID: On Tue, 5 Apr 2005 no_spam at somewhere.com wrote: > On the message I sent on March 14, does anyone had the chance to try the > modification? > > Or was it already fixed? (I haven't searched the archive extensively) > > Or maybe my message got catched by some spam filters? (it made it to the list > archive though) > > Anyway, I would appreciate some feedback (through the list) > The patch is here http://marc.theaimsgroup.com/?l=rxtx&m=111084488820288&w=2 I have applied this patch to a local copy but will not be doing formal testing for a couple weeks. I do not try to close ports from inside the eventListenter usually so I encourage any feedback also. If there are no problems reported, I expect this will go into rxtx 2.1-7. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Wed Apr 6 08:33:42 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Wed, 06 Apr 2005 15:33:42 +0100 Subject: [Rxtx] getting RXTX version Message-ID: <4253F346.50102@emation.pt> Hi, I want to make sure my deployments have the same version of RXTX jar and native lib. I know the version of the jar can be obtained in the Version class, but how can I obtain the native version ? I know RXTX prints to the console a warning if the version is different. Is there a way to programatically know is this is the case ? I would like to log that to our app's log thanks Ricardo From taj at www.linux.org.uk Wed Apr 6 15:10:20 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 6 Apr 2005 22:10:20 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4253F346.50102@emation.pt> References: <4253F346.50102@emation.pt> Message-ID: On Wed, 6 Apr 2005, Ricardo Trindade wrote: > Hi, > > I want to make sure my deployments have the same version of RXTX jar > and native lib. > > I know the version of the jar can be obtained in the Version class, > but how can I obtain the native version ? > > I know RXTX prints to the console a warning if the version is > different. Is there a way to programatically know is this is the case ? > > I would like to log that to our app's log > There isn't a suggested way of doing that right now. We could move things around and have a static String RXTXVersion.getNativeVersion() in future releases. Is this what you expected? This is not documented in commapi at all. I just tossed that in to catch conflicts while developing. It would be nice to have access in GUI applications though. It may be possible to access RXTXCommDriver.LibVersion right now. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Thu Apr 7 02:51:00 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 09:51:00 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> Message-ID: <4254F474.7020905@emation.pt> >There isn't a suggested way of doing that right now. We could move things >around and have a static String RXTXVersion.getNativeVersion() in future >releases. Is this what you expected? > > Yes, that would be perfect. >This is not documented in commapi at all. I just tossed that in to catch >conflicts while developing. It would be nice to have access in GUI >applications though. > >It may be possible to access RXTXCommDriver.LibVersion right now. > > > I tried, and I don't think it's possible. From taj at www.linux.org.uk Thu Apr 7 03:32:04 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 7 Apr 2005 10:32:04 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4254F474.7020905@emation.pt> References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: On Thu, 7 Apr 2005, Ricardo Trindade wrote: > > >There isn't a suggested way of doing that right now. We could move things > >around and have a static String RXTXVersion.getNativeVersion() in future > >releases. Is this what you expected? > > > > > > Yes, that would be perfect. > The attached should do what you want. You will still need to catch an exception for older versions... -- Trent Jarvi taj at www.linux.org.uk -------------- next part -------------- ? public_version.patch Index: RXTXCommDriver.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXCommDriver.java,v retrieving revision 1.16.2.51 diff -u -r1.16.2.51 RXTXCommDriver.java --- RXTXCommDriver.java 12 Oct 2004 09:13:30 -0000 1.16.2.51 +++ RXTXCommDriver.java 7 Apr 2005 09:29:04 -0000 @@ -54,7 +54,7 @@ the Library. */ String JarVersion = RXTXVersion.getVersion(); - String LibVersion = nativeGetVersion(); + String LibVersion = RXTXVersion.nativeGetVersion(); if ( devel ) { System.out.println("Devel Library"); @@ -76,7 +76,6 @@ /** Get the Serial port prefixes for the running OS */ private String deviceDirectory; private String osName; - private static native String nativeGetVersion(); private native boolean registerKnownPorts(int PortType); private native boolean isPortPrefixValid(String dev); private native boolean testRead(String dev, int type); Index: RXTXVersion.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXVersion.java,v retrieving revision 1.2.2.31 diff -u -r1.2.2.31 RXTXVersion.java --- RXTXVersion.java 16 Oct 2004 16:20:35 -0000 1.2.2.31 +++ RXTXVersion.java 7 Apr 2005 09:29:04 -0000 @@ -36,6 +36,7 @@ private static String Version; static { + System.loadLibrary( "rxtxSerial" ); Version = "RXTX-2.1-7pre20"; } /** @@ -47,4 +48,5 @@ { return(Version); } + public static native String nativeGetVersion(); } Index: SerialImp.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v retrieving revision 1.46.2.181 diff -u -r1.46.2.181 SerialImp.c --- SerialImp.c 17 Oct 2004 09:48:56 -0000 1.46.2.181 +++ SerialImp.c 7 Apr 2005 09:29:07 -0000 @@ -116,6 +116,7 @@ * It will eventually be removed. * */ #define RXTXPort(foo) Java_gnu_io_RXTXPort_ ## foo +#define RXTXVersion(foo) Java_gnu_io_RXTXVersion_ ## foo #define RXTXCommDriver(foo) Java_gnu_io_RXTXCommDriver_ ## foo #if defined(__sun__) || defined(__hpux__) @@ -4001,7 +4002,7 @@ } /*---------------------------------------------------------- -RXTXCommDriver.nativeGetVersion +RXTXVersion.nativeGetVersion accept: none perform: return the current version @@ -4010,9 +4011,10 @@ comments: This is used to avoid mixing versions of the .jar and native library. First introduced in rxtx-1.5-9 + Moved from RXTXCommDriver to RXTXVersion in rxtx-2.1-7 ----------------------------------------------------------*/ -JNIEXPORT jstring JNICALL RXTXCommDriver(nativeGetVersion) (JNIEnv *env, +JNIEXPORT jstring JNICALL RXTXVersion(nativeGetVersion) (JNIEnv *env, jclass jclazz ) { return (*env)->NewStringUTF( env, "RXTX-2.1-7pre20" ); From ricardo.trindade at emation.pt Thu Apr 7 03:45:58 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 10:45:58 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: <42550156.2040908@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050407/05212451/attachment-0059.html From thomas.shulok at lmco.com Thu Apr 7 17:43:11 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Thu, 07 Apr 2005 19:43:11 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi There, I'm attempting to talk RS232 between an embedded Linux box and a Windows box. Everything connects up fine, and I can send and receive a simple sequence of bytes with no problems. However, if around 5 seconds goes by without me sending something, I get the following when I attempt to send. java.io.IOException: Input/output error in writeArray Stack trace: java/lang/Throwable.()V java/lang/Throwable.(Ljava/lang/String;)V java/io/IOException.(Ljava/lang/String;)V gnu/io/RXTXPort.writeArray([BIIZ)V gnu/io/RXTXPort$SerialOutputStream.write([B)V SerialTest.main([Ljava/lang/String;)V If there interval is shorter (say 2 seconds between sends), I have no problems. On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and librxtxSerial-2.0.7pre2.so. Any ideas? Thanks, Thom -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5b23dcf/attachment-0059.html From taj at www.linux.org.uk Thu Apr 7 19:22:36 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:22:36 +0100 (BST) Subject: [Rxtx] Input/output error in writeArray In-Reply-To: References: Message-ID: On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a Windows > box. Everything connects up fine, and I can send and receive a simple > sequence of bytes with no problems. However, if around 5 seconds goes > by without me sending something, I get the following when I attempt to > send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Apr 7 19:24:59 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:24:59 +0100 (BST) Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) Message-ID: hmm. This would not work from applets would it? -- Trent Jarvi taj at www.linux.org.uk ---------- Forwarded message ---------- Date: Thu, 07 Apr 2005 16:05:53 -0400 From: Chris Gaffney To: taj at www.linux.org.uk Subject: RXTX Libraries on Classpath fix Hi, I submitted a patch for RXTX a few weeks ago to allow for loading the native libraries from the classpath. Since sending it to you I found it wasn't working on windows. I've fixed the problem and created a new patch that should replace the older one. The actual change is a one line from a String.equals() to a String.startsWith(). Thanks for a great piece of software, -Chris Gaffney Grand Valley State University -------------- next part -------------- A non-text attachment was scrubbed... Name: libraries_on_classpath_fixed.patch Type: text/x-patch Size: 5617 bytes Desc: Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5d423b8/libraries_on_classpath_fixed-0059.bin From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From thomas.shulok at lmco.com Fri Apr 8 10:38:55 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Fri, 08 Apr 2005 12:38:55 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi Trent, Thanks for the prompt response. Before diving deeper, I was wondering if there is a timeout parameter somewhere in the stack that I have not set properly. Given the nature of the failure (only fails if the line has been idle for a few seconds), it feels like some kind of timeout issue... Thanks again, Thom -----Original Message----- From: rxtx-bounces at mail.linuxgrrls.org [mailto:rxtx-bounces at mail.linuxgrrls.org] On Behalf Of Trent Jarvi Sent: Thursday, April 07, 2005 6:23 PM To: Java RXTX discussion Subject: Re: [Rxtx] Input/output error in writeArray On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a > Windows box. Everything connects up fine, and I can send and receive > a simple sequence of bytes with no problems. However, if around 5 > seconds goes by without me sending something, I get the following when > I attempt to send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at mail.linuxgrrls.org http://mail.linuxgrrls.org/mailman/listinfo/rxtx From ricardo.trindade at emation.pt Mon Apr 4 09:17:23 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Mon, 04 Apr 2005 16:17:23 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot Message-ID: <42515A83.4050907@emation.pt> Hi, I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most recent stable snapshot), and get the following exception : It looks like rxtx has been compiled with jdk 1.5. If this was indeed the case, I think there is a compilation flag that generates code that runs on older jdks. java.lang.UnsupportedClassVersionError: gnu/io/UnsupportedCommOperationException (Unsupported major.minor version 49.0) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at java.net.URLClassLoader.defineClass(URLClassLoader.java:251) at java.net.URLClassLoader.access$100(URLClassLoader.java:55) at java.net.URLClassLoader$1.run(URLClassLoader.java:194) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:187) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:141) I'm trying to run it with 1.4. thanks Ricardo From taj at www.linux.org.uk Tue Apr 5 00:48:12 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 07:48:12 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42515A83.4050907@emation.pt> References: <42515A83.4050907@emation.pt> Message-ID: On Mon, 4 Apr 2005, Ricardo Trindade wrote: > Hi, > > I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most > recent stable snapshot), and get the following exception : > > It looks like rxtx has been compiled with jdk 1.5. If this was > indeed the case, I think there is a compilation flag that generates code > that runs on older jdks. > > java.lang.UnsupportedClassVersionError: > gnu/io/UnsupportedCommOperationException (Unsupported major.minor > version 49.0) [snip] Thanks Ricardo I recompiled the jar with javac -source 1.3 -target 1.3. That should cover most of the JRE's in use today. I also compiled the rxtx 2.0 x86_64 native library which appeared to be missing. I tried looking for flags to pass gcc 4.0 to make the native libraries more backwards compatible but only found options for C++ which is not used in rxtx. I've got a list of other bugs that I'll be going through in the next few weeks but for now I just left them with the same CVS filename - no code changes. ftp://ftp.qbang.org/pub/rxtx/rxtx-2.0-CVS-20050120-bins.tar.gz ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-CVS-20050120-bins.tar.gz -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Tue Apr 5 02:24:33 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 05 Apr 2005 09:24:33 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: References: <42515A83.4050907@emation.pt> Message-ID: <42524B41.3040300@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050405/5919abbb/attachment-0060.html From taj at www.linux.org.uk Tue Apr 5 03:00:29 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 10:00:29 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42524B41.3040300@emation.pt> References: <42515A83.4050907@emation.pt> <42524B41.3040300@emation.pt> Message-ID: On Tue, 5 Apr 2005, Ricardo Trindade wrote: > Will you anounce to the list when a new release is available ? > There will be several incremental releases announced here. Once those are done, we will release 2.1.7 and 2.0.7. -- Trent Jarvi taj at www.linux.org.uk From no_spam at somewhere.com Tue Apr 5 11:55:37 2005 From: no_spam at somewhere.com (no_spam@somewhere.com) Date: Tue, 5 Apr 2005 13:55:37 -0400 Subject: [Rxtx] Closing a port from an event listener results in a deadlock Message-ID: <20050405175537.GA21747@rcog.homelinux.net> On the message I sent on March 14, does anyone had the chance to try the modification? Or was it already fixed? (I haven't searched the archive extensively) Or maybe my message got catched by some spam filters? (it made it to the list archive though) Anyway, I would appreciate some feedback (through the list) Thanks From taj at www.linux.org.uk Tue Apr 5 14:42:28 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 21:42:28 +0100 (BST) Subject: [Rxtx] Closing a port from an event listener results in a deadlock In-Reply-To: <20050405175537.GA21747@rcog.homelinux.net> References: <20050405175537.GA21747@rcog.homelinux.net> Message-ID: On Tue, 5 Apr 2005 no_spam at somewhere.com wrote: > On the message I sent on March 14, does anyone had the chance to try the > modification? > > Or was it already fixed? (I haven't searched the archive extensively) > > Or maybe my message got catched by some spam filters? (it made it to the list > archive though) > > Anyway, I would appreciate some feedback (through the list) > The patch is here http://marc.theaimsgroup.com/?l=rxtx&m=111084488820288&w=2 I have applied this patch to a local copy but will not be doing formal testing for a couple weeks. I do not try to close ports from inside the eventListenter usually so I encourage any feedback also. If there are no problems reported, I expect this will go into rxtx 2.1-7. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Wed Apr 6 08:33:42 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Wed, 06 Apr 2005 15:33:42 +0100 Subject: [Rxtx] getting RXTX version Message-ID: <4253F346.50102@emation.pt> Hi, I want to make sure my deployments have the same version of RXTX jar and native lib. I know the version of the jar can be obtained in the Version class, but how can I obtain the native version ? I know RXTX prints to the console a warning if the version is different. Is there a way to programatically know is this is the case ? I would like to log that to our app's log thanks Ricardo From taj at www.linux.org.uk Wed Apr 6 15:10:20 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 6 Apr 2005 22:10:20 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4253F346.50102@emation.pt> References: <4253F346.50102@emation.pt> Message-ID: On Wed, 6 Apr 2005, Ricardo Trindade wrote: > Hi, > > I want to make sure my deployments have the same version of RXTX jar > and native lib. > > I know the version of the jar can be obtained in the Version class, > but how can I obtain the native version ? > > I know RXTX prints to the console a warning if the version is > different. Is there a way to programatically know is this is the case ? > > I would like to log that to our app's log > There isn't a suggested way of doing that right now. We could move things around and have a static String RXTXVersion.getNativeVersion() in future releases. Is this what you expected? This is not documented in commapi at all. I just tossed that in to catch conflicts while developing. It would be nice to have access in GUI applications though. It may be possible to access RXTXCommDriver.LibVersion right now. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Thu Apr 7 02:51:00 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 09:51:00 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> Message-ID: <4254F474.7020905@emation.pt> >There isn't a suggested way of doing that right now. We could move things >around and have a static String RXTXVersion.getNativeVersion() in future >releases. Is this what you expected? > > Yes, that would be perfect. >This is not documented in commapi at all. I just tossed that in to catch >conflicts while developing. It would be nice to have access in GUI >applications though. > >It may be possible to access RXTXCommDriver.LibVersion right now. > > > I tried, and I don't think it's possible. From taj at www.linux.org.uk Thu Apr 7 03:32:04 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 7 Apr 2005 10:32:04 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4254F474.7020905@emation.pt> References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: On Thu, 7 Apr 2005, Ricardo Trindade wrote: > > >There isn't a suggested way of doing that right now. We could move things > >around and have a static String RXTXVersion.getNativeVersion() in future > >releases. Is this what you expected? > > > > > > Yes, that would be perfect. > The attached should do what you want. You will still need to catch an exception for older versions... -- Trent Jarvi taj at www.linux.org.uk -------------- next part -------------- ? public_version.patch Index: RXTXCommDriver.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXCommDriver.java,v retrieving revision 1.16.2.51 diff -u -r1.16.2.51 RXTXCommDriver.java --- RXTXCommDriver.java 12 Oct 2004 09:13:30 -0000 1.16.2.51 +++ RXTXCommDriver.java 7 Apr 2005 09:29:04 -0000 @@ -54,7 +54,7 @@ the Library. */ String JarVersion = RXTXVersion.getVersion(); - String LibVersion = nativeGetVersion(); + String LibVersion = RXTXVersion.nativeGetVersion(); if ( devel ) { System.out.println("Devel Library"); @@ -76,7 +76,6 @@ /** Get the Serial port prefixes for the running OS */ private String deviceDirectory; private String osName; - private static native String nativeGetVersion(); private native boolean registerKnownPorts(int PortType); private native boolean isPortPrefixValid(String dev); private native boolean testRead(String dev, int type); Index: RXTXVersion.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXVersion.java,v retrieving revision 1.2.2.31 diff -u -r1.2.2.31 RXTXVersion.java --- RXTXVersion.java 16 Oct 2004 16:20:35 -0000 1.2.2.31 +++ RXTXVersion.java 7 Apr 2005 09:29:04 -0000 @@ -36,6 +36,7 @@ private static String Version; static { + System.loadLibrary( "rxtxSerial" ); Version = "RXTX-2.1-7pre20"; } /** @@ -47,4 +48,5 @@ { return(Version); } + public static native String nativeGetVersion(); } Index: SerialImp.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v retrieving revision 1.46.2.181 diff -u -r1.46.2.181 SerialImp.c --- SerialImp.c 17 Oct 2004 09:48:56 -0000 1.46.2.181 +++ SerialImp.c 7 Apr 2005 09:29:07 -0000 @@ -116,6 +116,7 @@ * It will eventually be removed. * */ #define RXTXPort(foo) Java_gnu_io_RXTXPort_ ## foo +#define RXTXVersion(foo) Java_gnu_io_RXTXVersion_ ## foo #define RXTXCommDriver(foo) Java_gnu_io_RXTXCommDriver_ ## foo #if defined(__sun__) || defined(__hpux__) @@ -4001,7 +4002,7 @@ } /*---------------------------------------------------------- -RXTXCommDriver.nativeGetVersion +RXTXVersion.nativeGetVersion accept: none perform: return the current version @@ -4010,9 +4011,10 @@ comments: This is used to avoid mixing versions of the .jar and native library. First introduced in rxtx-1.5-9 + Moved from RXTXCommDriver to RXTXVersion in rxtx-2.1-7 ----------------------------------------------------------*/ -JNIEXPORT jstring JNICALL RXTXCommDriver(nativeGetVersion) (JNIEnv *env, +JNIEXPORT jstring JNICALL RXTXVersion(nativeGetVersion) (JNIEnv *env, jclass jclazz ) { return (*env)->NewStringUTF( env, "RXTX-2.1-7pre20" ); From ricardo.trindade at emation.pt Thu Apr 7 03:45:58 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 10:45:58 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: <42550156.2040908@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050407/05212451/attachment-0060.html From thomas.shulok at lmco.com Thu Apr 7 17:43:11 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Thu, 07 Apr 2005 19:43:11 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi There, I'm attempting to talk RS232 between an embedded Linux box and a Windows box. Everything connects up fine, and I can send and receive a simple sequence of bytes with no problems. However, if around 5 seconds goes by without me sending something, I get the following when I attempt to send. java.io.IOException: Input/output error in writeArray Stack trace: java/lang/Throwable.()V java/lang/Throwable.(Ljava/lang/String;)V java/io/IOException.(Ljava/lang/String;)V gnu/io/RXTXPort.writeArray([BIIZ)V gnu/io/RXTXPort$SerialOutputStream.write([B)V SerialTest.main([Ljava/lang/String;)V If there interval is shorter (say 2 seconds between sends), I have no problems. On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and librxtxSerial-2.0.7pre2.so. Any ideas? Thanks, Thom -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5b23dcf/attachment-0060.html From taj at www.linux.org.uk Thu Apr 7 19:22:36 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:22:36 +0100 (BST) Subject: [Rxtx] Input/output error in writeArray In-Reply-To: References: Message-ID: On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a Windows > box. Everything connects up fine, and I can send and receive a simple > sequence of bytes with no problems. However, if around 5 seconds goes > by without me sending something, I get the following when I attempt to > send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Apr 7 19:24:59 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:24:59 +0100 (BST) Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) Message-ID: hmm. This would not work from applets would it? -- Trent Jarvi taj at www.linux.org.uk ---------- Forwarded message ---------- Date: Thu, 07 Apr 2005 16:05:53 -0400 From: Chris Gaffney To: taj at www.linux.org.uk Subject: RXTX Libraries on Classpath fix Hi, I submitted a patch for RXTX a few weeks ago to allow for loading the native libraries from the classpath. Since sending it to you I found it wasn't working on windows. I've fixed the problem and created a new patch that should replace the older one. The actual change is a one line from a String.equals() to a String.startsWith(). Thanks for a great piece of software, -Chris Gaffney Grand Valley State University -------------- next part -------------- A non-text attachment was scrubbed... Name: libraries_on_classpath_fixed.patch Type: text/x-patch Size: 5617 bytes Desc: Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5d423b8/libraries_on_classpath_fixed-0060.bin From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From thomas.shulok at lmco.com Fri Apr 8 10:38:55 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Fri, 08 Apr 2005 12:38:55 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi Trent, Thanks for the prompt response. Before diving deeper, I was wondering if there is a timeout parameter somewhere in the stack that I have not set properly. Given the nature of the failure (only fails if the line has been idle for a few seconds), it feels like some kind of timeout issue... Thanks again, Thom -----Original Message----- From: rxtx-bounces at mail.linuxgrrls.org [mailto:rxtx-bounces at mail.linuxgrrls.org] On Behalf Of Trent Jarvi Sent: Thursday, April 07, 2005 6:23 PM To: Java RXTX discussion Subject: Re: [Rxtx] Input/output error in writeArray On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a > Windows box. Everything connects up fine, and I can send and receive > a simple sequence of bytes with no problems. However, if around 5 > seconds goes by without me sending something, I get the following when > I attempt to send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at mail.linuxgrrls.org http://mail.linuxgrrls.org/mailman/listinfo/rxtx From ricardo.trindade at emation.pt Mon Apr 4 09:17:23 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Mon, 04 Apr 2005 16:17:23 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot Message-ID: <42515A83.4050907@emation.pt> Hi, I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most recent stable snapshot), and get the following exception : It looks like rxtx has been compiled with jdk 1.5. If this was indeed the case, I think there is a compilation flag that generates code that runs on older jdks. java.lang.UnsupportedClassVersionError: gnu/io/UnsupportedCommOperationException (Unsupported major.minor version 49.0) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at java.net.URLClassLoader.defineClass(URLClassLoader.java:251) at java.net.URLClassLoader.access$100(URLClassLoader.java:55) at java.net.URLClassLoader$1.run(URLClassLoader.java:194) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:187) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:141) I'm trying to run it with 1.4. thanks Ricardo From taj at www.linux.org.uk Tue Apr 5 00:48:12 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 07:48:12 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42515A83.4050907@emation.pt> References: <42515A83.4050907@emation.pt> Message-ID: On Mon, 4 Apr 2005, Ricardo Trindade wrote: > Hi, > > I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most > recent stable snapshot), and get the following exception : > > It looks like rxtx has been compiled with jdk 1.5. If this was > indeed the case, I think there is a compilation flag that generates code > that runs on older jdks. > > java.lang.UnsupportedClassVersionError: > gnu/io/UnsupportedCommOperationException (Unsupported major.minor > version 49.0) [snip] Thanks Ricardo I recompiled the jar with javac -source 1.3 -target 1.3. That should cover most of the JRE's in use today. I also compiled the rxtx 2.0 x86_64 native library which appeared to be missing. I tried looking for flags to pass gcc 4.0 to make the native libraries more backwards compatible but only found options for C++ which is not used in rxtx. I've got a list of other bugs that I'll be going through in the next few weeks but for now I just left them with the same CVS filename - no code changes. ftp://ftp.qbang.org/pub/rxtx/rxtx-2.0-CVS-20050120-bins.tar.gz ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-CVS-20050120-bins.tar.gz -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Tue Apr 5 02:24:33 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 05 Apr 2005 09:24:33 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: References: <42515A83.4050907@emation.pt> Message-ID: <42524B41.3040300@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050405/5919abbb/attachment-0061.html From taj at www.linux.org.uk Tue Apr 5 03:00:29 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 10:00:29 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42524B41.3040300@emation.pt> References: <42515A83.4050907@emation.pt> <42524B41.3040300@emation.pt> Message-ID: On Tue, 5 Apr 2005, Ricardo Trindade wrote: > Will you anounce to the list when a new release is available ? > There will be several incremental releases announced here. Once those are done, we will release 2.1.7 and 2.0.7. -- Trent Jarvi taj at www.linux.org.uk From no_spam at somewhere.com Tue Apr 5 11:55:37 2005 From: no_spam at somewhere.com (no_spam@somewhere.com) Date: Tue, 5 Apr 2005 13:55:37 -0400 Subject: [Rxtx] Closing a port from an event listener results in a deadlock Message-ID: <20050405175537.GA21747@rcog.homelinux.net> On the message I sent on March 14, does anyone had the chance to try the modification? Or was it already fixed? (I haven't searched the archive extensively) Or maybe my message got catched by some spam filters? (it made it to the list archive though) Anyway, I would appreciate some feedback (through the list) Thanks From taj at www.linux.org.uk Tue Apr 5 14:42:28 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 21:42:28 +0100 (BST) Subject: [Rxtx] Closing a port from an event listener results in a deadlock In-Reply-To: <20050405175537.GA21747@rcog.homelinux.net> References: <20050405175537.GA21747@rcog.homelinux.net> Message-ID: On Tue, 5 Apr 2005 no_spam at somewhere.com wrote: > On the message I sent on March 14, does anyone had the chance to try the > modification? > > Or was it already fixed? (I haven't searched the archive extensively) > > Or maybe my message got catched by some spam filters? (it made it to the list > archive though) > > Anyway, I would appreciate some feedback (through the list) > The patch is here http://marc.theaimsgroup.com/?l=rxtx&m=111084488820288&w=2 I have applied this patch to a local copy but will not be doing formal testing for a couple weeks. I do not try to close ports from inside the eventListenter usually so I encourage any feedback also. If there are no problems reported, I expect this will go into rxtx 2.1-7. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Wed Apr 6 08:33:42 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Wed, 06 Apr 2005 15:33:42 +0100 Subject: [Rxtx] getting RXTX version Message-ID: <4253F346.50102@emation.pt> Hi, I want to make sure my deployments have the same version of RXTX jar and native lib. I know the version of the jar can be obtained in the Version class, but how can I obtain the native version ? I know RXTX prints to the console a warning if the version is different. Is there a way to programatically know is this is the case ? I would like to log that to our app's log thanks Ricardo From taj at www.linux.org.uk Wed Apr 6 15:10:20 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 6 Apr 2005 22:10:20 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4253F346.50102@emation.pt> References: <4253F346.50102@emation.pt> Message-ID: On Wed, 6 Apr 2005, Ricardo Trindade wrote: > Hi, > > I want to make sure my deployments have the same version of RXTX jar > and native lib. > > I know the version of the jar can be obtained in the Version class, > but how can I obtain the native version ? > > I know RXTX prints to the console a warning if the version is > different. Is there a way to programatically know is this is the case ? > > I would like to log that to our app's log > There isn't a suggested way of doing that right now. We could move things around and have a static String RXTXVersion.getNativeVersion() in future releases. Is this what you expected? This is not documented in commapi at all. I just tossed that in to catch conflicts while developing. It would be nice to have access in GUI applications though. It may be possible to access RXTXCommDriver.LibVersion right now. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Thu Apr 7 02:51:00 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 09:51:00 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> Message-ID: <4254F474.7020905@emation.pt> >There isn't a suggested way of doing that right now. We could move things >around and have a static String RXTXVersion.getNativeVersion() in future >releases. Is this what you expected? > > Yes, that would be perfect. >This is not documented in commapi at all. I just tossed that in to catch >conflicts while developing. It would be nice to have access in GUI >applications though. > >It may be possible to access RXTXCommDriver.LibVersion right now. > > > I tried, and I don't think it's possible. From taj at www.linux.org.uk Thu Apr 7 03:32:04 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 7 Apr 2005 10:32:04 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4254F474.7020905@emation.pt> References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: On Thu, 7 Apr 2005, Ricardo Trindade wrote: > > >There isn't a suggested way of doing that right now. We could move things > >around and have a static String RXTXVersion.getNativeVersion() in future > >releases. Is this what you expected? > > > > > > Yes, that would be perfect. > The attached should do what you want. You will still need to catch an exception for older versions... -- Trent Jarvi taj at www.linux.org.uk -------------- next part -------------- ? public_version.patch Index: RXTXCommDriver.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXCommDriver.java,v retrieving revision 1.16.2.51 diff -u -r1.16.2.51 RXTXCommDriver.java --- RXTXCommDriver.java 12 Oct 2004 09:13:30 -0000 1.16.2.51 +++ RXTXCommDriver.java 7 Apr 2005 09:29:04 -0000 @@ -54,7 +54,7 @@ the Library. */ String JarVersion = RXTXVersion.getVersion(); - String LibVersion = nativeGetVersion(); + String LibVersion = RXTXVersion.nativeGetVersion(); if ( devel ) { System.out.println("Devel Library"); @@ -76,7 +76,6 @@ /** Get the Serial port prefixes for the running OS */ private String deviceDirectory; private String osName; - private static native String nativeGetVersion(); private native boolean registerKnownPorts(int PortType); private native boolean isPortPrefixValid(String dev); private native boolean testRead(String dev, int type); Index: RXTXVersion.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXVersion.java,v retrieving revision 1.2.2.31 diff -u -r1.2.2.31 RXTXVersion.java --- RXTXVersion.java 16 Oct 2004 16:20:35 -0000 1.2.2.31 +++ RXTXVersion.java 7 Apr 2005 09:29:04 -0000 @@ -36,6 +36,7 @@ private static String Version; static { + System.loadLibrary( "rxtxSerial" ); Version = "RXTX-2.1-7pre20"; } /** @@ -47,4 +48,5 @@ { return(Version); } + public static native String nativeGetVersion(); } Index: SerialImp.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v retrieving revision 1.46.2.181 diff -u -r1.46.2.181 SerialImp.c --- SerialImp.c 17 Oct 2004 09:48:56 -0000 1.46.2.181 +++ SerialImp.c 7 Apr 2005 09:29:07 -0000 @@ -116,6 +116,7 @@ * It will eventually be removed. * */ #define RXTXPort(foo) Java_gnu_io_RXTXPort_ ## foo +#define RXTXVersion(foo) Java_gnu_io_RXTXVersion_ ## foo #define RXTXCommDriver(foo) Java_gnu_io_RXTXCommDriver_ ## foo #if defined(__sun__) || defined(__hpux__) @@ -4001,7 +4002,7 @@ } /*---------------------------------------------------------- -RXTXCommDriver.nativeGetVersion +RXTXVersion.nativeGetVersion accept: none perform: return the current version @@ -4010,9 +4011,10 @@ comments: This is used to avoid mixing versions of the .jar and native library. First introduced in rxtx-1.5-9 + Moved from RXTXCommDriver to RXTXVersion in rxtx-2.1-7 ----------------------------------------------------------*/ -JNIEXPORT jstring JNICALL RXTXCommDriver(nativeGetVersion) (JNIEnv *env, +JNIEXPORT jstring JNICALL RXTXVersion(nativeGetVersion) (JNIEnv *env, jclass jclazz ) { return (*env)->NewStringUTF( env, "RXTX-2.1-7pre20" ); From ricardo.trindade at emation.pt Thu Apr 7 03:45:58 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 10:45:58 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: <42550156.2040908@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050407/05212451/attachment-0061.html From thomas.shulok at lmco.com Thu Apr 7 17:43:11 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Thu, 07 Apr 2005 19:43:11 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi There, I'm attempting to talk RS232 between an embedded Linux box and a Windows box. Everything connects up fine, and I can send and receive a simple sequence of bytes with no problems. However, if around 5 seconds goes by without me sending something, I get the following when I attempt to send. java.io.IOException: Input/output error in writeArray Stack trace: java/lang/Throwable.()V java/lang/Throwable.(Ljava/lang/String;)V java/io/IOException.(Ljava/lang/String;)V gnu/io/RXTXPort.writeArray([BIIZ)V gnu/io/RXTXPort$SerialOutputStream.write([B)V SerialTest.main([Ljava/lang/String;)V If there interval is shorter (say 2 seconds between sends), I have no problems. On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and librxtxSerial-2.0.7pre2.so. Any ideas? Thanks, Thom -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5b23dcf/attachment-0061.html From taj at www.linux.org.uk Thu Apr 7 19:22:36 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:22:36 +0100 (BST) Subject: [Rxtx] Input/output error in writeArray In-Reply-To: References: Message-ID: On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a Windows > box. Everything connects up fine, and I can send and receive a simple > sequence of bytes with no problems. However, if around 5 seconds goes > by without me sending something, I get the following when I attempt to > send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Apr 7 19:24:59 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:24:59 +0100 (BST) Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) Message-ID: hmm. This would not work from applets would it? -- Trent Jarvi taj at www.linux.org.uk ---------- Forwarded message ---------- Date: Thu, 07 Apr 2005 16:05:53 -0400 From: Chris Gaffney To: taj at www.linux.org.uk Subject: RXTX Libraries on Classpath fix Hi, I submitted a patch for RXTX a few weeks ago to allow for loading the native libraries from the classpath. Since sending it to you I found it wasn't working on windows. I've fixed the problem and created a new patch that should replace the older one. The actual change is a one line from a String.equals() to a String.startsWith(). Thanks for a great piece of software, -Chris Gaffney Grand Valley State University -------------- next part -------------- A non-text attachment was scrubbed... Name: libraries_on_classpath_fixed.patch Type: text/x-patch Size: 5617 bytes Desc: Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5d423b8/libraries_on_classpath_fixed-0061.bin From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From thomas.shulok at lmco.com Fri Apr 8 10:38:55 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Fri, 08 Apr 2005 12:38:55 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi Trent, Thanks for the prompt response. Before diving deeper, I was wondering if there is a timeout parameter somewhere in the stack that I have not set properly. Given the nature of the failure (only fails if the line has been idle for a few seconds), it feels like some kind of timeout issue... Thanks again, Thom -----Original Message----- From: rxtx-bounces at mail.linuxgrrls.org [mailto:rxtx-bounces at mail.linuxgrrls.org] On Behalf Of Trent Jarvi Sent: Thursday, April 07, 2005 6:23 PM To: Java RXTX discussion Subject: Re: [Rxtx] Input/output error in writeArray On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a > Windows box. Everything connects up fine, and I can send and receive > a simple sequence of bytes with no problems. However, if around 5 > seconds goes by without me sending something, I get the following when > I attempt to send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at mail.linuxgrrls.org http://mail.linuxgrrls.org/mailman/listinfo/rxtx From ricardo.trindade at emation.pt Mon Apr 4 09:17:23 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Mon, 04 Apr 2005 16:17:23 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot Message-ID: <42515A83.4050907@emation.pt> Hi, I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most recent stable snapshot), and get the following exception : It looks like rxtx has been compiled with jdk 1.5. If this was indeed the case, I think there is a compilation flag that generates code that runs on older jdks. java.lang.UnsupportedClassVersionError: gnu/io/UnsupportedCommOperationException (Unsupported major.minor version 49.0) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at java.net.URLClassLoader.defineClass(URLClassLoader.java:251) at java.net.URLClassLoader.access$100(URLClassLoader.java:55) at java.net.URLClassLoader$1.run(URLClassLoader.java:194) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:187) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:141) I'm trying to run it with 1.4. thanks Ricardo From taj at www.linux.org.uk Tue Apr 5 00:48:12 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 07:48:12 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42515A83.4050907@emation.pt> References: <42515A83.4050907@emation.pt> Message-ID: On Mon, 4 Apr 2005, Ricardo Trindade wrote: > Hi, > > I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most > recent stable snapshot), and get the following exception : > > It looks like rxtx has been compiled with jdk 1.5. If this was > indeed the case, I think there is a compilation flag that generates code > that runs on older jdks. > > java.lang.UnsupportedClassVersionError: > gnu/io/UnsupportedCommOperationException (Unsupported major.minor > version 49.0) [snip] Thanks Ricardo I recompiled the jar with javac -source 1.3 -target 1.3. That should cover most of the JRE's in use today. I also compiled the rxtx 2.0 x86_64 native library which appeared to be missing. I tried looking for flags to pass gcc 4.0 to make the native libraries more backwards compatible but only found options for C++ which is not used in rxtx. I've got a list of other bugs that I'll be going through in the next few weeks but for now I just left them with the same CVS filename - no code changes. ftp://ftp.qbang.org/pub/rxtx/rxtx-2.0-CVS-20050120-bins.tar.gz ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-CVS-20050120-bins.tar.gz -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Tue Apr 5 02:24:33 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 05 Apr 2005 09:24:33 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: References: <42515A83.4050907@emation.pt> Message-ID: <42524B41.3040300@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050405/5919abbb/attachment-0062.html From taj at www.linux.org.uk Tue Apr 5 03:00:29 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 10:00:29 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42524B41.3040300@emation.pt> References: <42515A83.4050907@emation.pt> <42524B41.3040300@emation.pt> Message-ID: On Tue, 5 Apr 2005, Ricardo Trindade wrote: > Will you anounce to the list when a new release is available ? > There will be several incremental releases announced here. Once those are done, we will release 2.1.7 and 2.0.7. -- Trent Jarvi taj at www.linux.org.uk From no_spam at somewhere.com Tue Apr 5 11:55:37 2005 From: no_spam at somewhere.com (no_spam@somewhere.com) Date: Tue, 5 Apr 2005 13:55:37 -0400 Subject: [Rxtx] Closing a port from an event listener results in a deadlock Message-ID: <20050405175537.GA21747@rcog.homelinux.net> On the message I sent on March 14, does anyone had the chance to try the modification? Or was it already fixed? (I haven't searched the archive extensively) Or maybe my message got catched by some spam filters? (it made it to the list archive though) Anyway, I would appreciate some feedback (through the list) Thanks From taj at www.linux.org.uk Tue Apr 5 14:42:28 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 21:42:28 +0100 (BST) Subject: [Rxtx] Closing a port from an event listener results in a deadlock In-Reply-To: <20050405175537.GA21747@rcog.homelinux.net> References: <20050405175537.GA21747@rcog.homelinux.net> Message-ID: On Tue, 5 Apr 2005 no_spam at somewhere.com wrote: > On the message I sent on March 14, does anyone had the chance to try the > modification? > > Or was it already fixed? (I haven't searched the archive extensively) > > Or maybe my message got catched by some spam filters? (it made it to the list > archive though) > > Anyway, I would appreciate some feedback (through the list) > The patch is here http://marc.theaimsgroup.com/?l=rxtx&m=111084488820288&w=2 I have applied this patch to a local copy but will not be doing formal testing for a couple weeks. I do not try to close ports from inside the eventListenter usually so I encourage any feedback also. If there are no problems reported, I expect this will go into rxtx 2.1-7. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Wed Apr 6 08:33:42 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Wed, 06 Apr 2005 15:33:42 +0100 Subject: [Rxtx] getting RXTX version Message-ID: <4253F346.50102@emation.pt> Hi, I want to make sure my deployments have the same version of RXTX jar and native lib. I know the version of the jar can be obtained in the Version class, but how can I obtain the native version ? I know RXTX prints to the console a warning if the version is different. Is there a way to programatically know is this is the case ? I would like to log that to our app's log thanks Ricardo From taj at www.linux.org.uk Wed Apr 6 15:10:20 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 6 Apr 2005 22:10:20 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4253F346.50102@emation.pt> References: <4253F346.50102@emation.pt> Message-ID: On Wed, 6 Apr 2005, Ricardo Trindade wrote: > Hi, > > I want to make sure my deployments have the same version of RXTX jar > and native lib. > > I know the version of the jar can be obtained in the Version class, > but how can I obtain the native version ? > > I know RXTX prints to the console a warning if the version is > different. Is there a way to programatically know is this is the case ? > > I would like to log that to our app's log > There isn't a suggested way of doing that right now. We could move things around and have a static String RXTXVersion.getNativeVersion() in future releases. Is this what you expected? This is not documented in commapi at all. I just tossed that in to catch conflicts while developing. It would be nice to have access in GUI applications though. It may be possible to access RXTXCommDriver.LibVersion right now. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Thu Apr 7 02:51:00 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 09:51:00 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> Message-ID: <4254F474.7020905@emation.pt> >There isn't a suggested way of doing that right now. We could move things >around and have a static String RXTXVersion.getNativeVersion() in future >releases. Is this what you expected? > > Yes, that would be perfect. >This is not documented in commapi at all. I just tossed that in to catch >conflicts while developing. It would be nice to have access in GUI >applications though. > >It may be possible to access RXTXCommDriver.LibVersion right now. > > > I tried, and I don't think it's possible. From taj at www.linux.org.uk Thu Apr 7 03:32:04 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 7 Apr 2005 10:32:04 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4254F474.7020905@emation.pt> References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: On Thu, 7 Apr 2005, Ricardo Trindade wrote: > > >There isn't a suggested way of doing that right now. We could move things > >around and have a static String RXTXVersion.getNativeVersion() in future > >releases. Is this what you expected? > > > > > > Yes, that would be perfect. > The attached should do what you want. You will still need to catch an exception for older versions... -- Trent Jarvi taj at www.linux.org.uk -------------- next part -------------- ? public_version.patch Index: RXTXCommDriver.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXCommDriver.java,v retrieving revision 1.16.2.51 diff -u -r1.16.2.51 RXTXCommDriver.java --- RXTXCommDriver.java 12 Oct 2004 09:13:30 -0000 1.16.2.51 +++ RXTXCommDriver.java 7 Apr 2005 09:29:04 -0000 @@ -54,7 +54,7 @@ the Library. */ String JarVersion = RXTXVersion.getVersion(); - String LibVersion = nativeGetVersion(); + String LibVersion = RXTXVersion.nativeGetVersion(); if ( devel ) { System.out.println("Devel Library"); @@ -76,7 +76,6 @@ /** Get the Serial port prefixes for the running OS */ private String deviceDirectory; private String osName; - private static native String nativeGetVersion(); private native boolean registerKnownPorts(int PortType); private native boolean isPortPrefixValid(String dev); private native boolean testRead(String dev, int type); Index: RXTXVersion.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXVersion.java,v retrieving revision 1.2.2.31 diff -u -r1.2.2.31 RXTXVersion.java --- RXTXVersion.java 16 Oct 2004 16:20:35 -0000 1.2.2.31 +++ RXTXVersion.java 7 Apr 2005 09:29:04 -0000 @@ -36,6 +36,7 @@ private static String Version; static { + System.loadLibrary( "rxtxSerial" ); Version = "RXTX-2.1-7pre20"; } /** @@ -47,4 +48,5 @@ { return(Version); } + public static native String nativeGetVersion(); } Index: SerialImp.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v retrieving revision 1.46.2.181 diff -u -r1.46.2.181 SerialImp.c --- SerialImp.c 17 Oct 2004 09:48:56 -0000 1.46.2.181 +++ SerialImp.c 7 Apr 2005 09:29:07 -0000 @@ -116,6 +116,7 @@ * It will eventually be removed. * */ #define RXTXPort(foo) Java_gnu_io_RXTXPort_ ## foo +#define RXTXVersion(foo) Java_gnu_io_RXTXVersion_ ## foo #define RXTXCommDriver(foo) Java_gnu_io_RXTXCommDriver_ ## foo #if defined(__sun__) || defined(__hpux__) @@ -4001,7 +4002,7 @@ } /*---------------------------------------------------------- -RXTXCommDriver.nativeGetVersion +RXTXVersion.nativeGetVersion accept: none perform: return the current version @@ -4010,9 +4011,10 @@ comments: This is used to avoid mixing versions of the .jar and native library. First introduced in rxtx-1.5-9 + Moved from RXTXCommDriver to RXTXVersion in rxtx-2.1-7 ----------------------------------------------------------*/ -JNIEXPORT jstring JNICALL RXTXCommDriver(nativeGetVersion) (JNIEnv *env, +JNIEXPORT jstring JNICALL RXTXVersion(nativeGetVersion) (JNIEnv *env, jclass jclazz ) { return (*env)->NewStringUTF( env, "RXTX-2.1-7pre20" ); From ricardo.trindade at emation.pt Thu Apr 7 03:45:58 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 10:45:58 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: <42550156.2040908@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050407/05212451/attachment-0062.html From thomas.shulok at lmco.com Thu Apr 7 17:43:11 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Thu, 07 Apr 2005 19:43:11 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi There, I'm attempting to talk RS232 between an embedded Linux box and a Windows box. Everything connects up fine, and I can send and receive a simple sequence of bytes with no problems. However, if around 5 seconds goes by without me sending something, I get the following when I attempt to send. java.io.IOException: Input/output error in writeArray Stack trace: java/lang/Throwable.()V java/lang/Throwable.(Ljava/lang/String;)V java/io/IOException.(Ljava/lang/String;)V gnu/io/RXTXPort.writeArray([BIIZ)V gnu/io/RXTXPort$SerialOutputStream.write([B)V SerialTest.main([Ljava/lang/String;)V If there interval is shorter (say 2 seconds between sends), I have no problems. On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and librxtxSerial-2.0.7pre2.so. Any ideas? Thanks, Thom -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5b23dcf/attachment-0062.html From taj at www.linux.org.uk Thu Apr 7 19:22:36 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:22:36 +0100 (BST) Subject: [Rxtx] Input/output error in writeArray In-Reply-To: References: Message-ID: On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a Windows > box. Everything connects up fine, and I can send and receive a simple > sequence of bytes with no problems. However, if around 5 seconds goes > by without me sending something, I get the following when I attempt to > send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Apr 7 19:24:59 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:24:59 +0100 (BST) Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) Message-ID: hmm. This would not work from applets would it? -- Trent Jarvi taj at www.linux.org.uk ---------- Forwarded message ---------- Date: Thu, 07 Apr 2005 16:05:53 -0400 From: Chris Gaffney To: taj at www.linux.org.uk Subject: RXTX Libraries on Classpath fix Hi, I submitted a patch for RXTX a few weeks ago to allow for loading the native libraries from the classpath. Since sending it to you I found it wasn't working on windows. I've fixed the problem and created a new patch that should replace the older one. The actual change is a one line from a String.equals() to a String.startsWith(). Thanks for a great piece of software, -Chris Gaffney Grand Valley State University -------------- next part -------------- A non-text attachment was scrubbed... Name: libraries_on_classpath_fixed.patch Type: text/x-patch Size: 5617 bytes Desc: Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5d423b8/libraries_on_classpath_fixed-0062.bin From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From thomas.shulok at lmco.com Fri Apr 8 10:38:55 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Fri, 08 Apr 2005 12:38:55 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi Trent, Thanks for the prompt response. Before diving deeper, I was wondering if there is a timeout parameter somewhere in the stack that I have not set properly. Given the nature of the failure (only fails if the line has been idle for a few seconds), it feels like some kind of timeout issue... Thanks again, Thom -----Original Message----- From: rxtx-bounces at mail.linuxgrrls.org [mailto:rxtx-bounces at mail.linuxgrrls.org] On Behalf Of Trent Jarvi Sent: Thursday, April 07, 2005 6:23 PM To: Java RXTX discussion Subject: Re: [Rxtx] Input/output error in writeArray On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a > Windows box. Everything connects up fine, and I can send and receive > a simple sequence of bytes with no problems. However, if around 5 > seconds goes by without me sending something, I get the following when > I attempt to send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at mail.linuxgrrls.org http://mail.linuxgrrls.org/mailman/listinfo/rxtx From ricardo.trindade at emation.pt Mon Apr 4 09:17:23 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Mon, 04 Apr 2005 16:17:23 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot Message-ID: <42515A83.4050907@emation.pt> Hi, I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most recent stable snapshot), and get the following exception : It looks like rxtx has been compiled with jdk 1.5. If this was indeed the case, I think there is a compilation flag that generates code that runs on older jdks. java.lang.UnsupportedClassVersionError: gnu/io/UnsupportedCommOperationException (Unsupported major.minor version 49.0) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at java.net.URLClassLoader.defineClass(URLClassLoader.java:251) at java.net.URLClassLoader.access$100(URLClassLoader.java:55) at java.net.URLClassLoader$1.run(URLClassLoader.java:194) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:187) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:141) I'm trying to run it with 1.4. thanks Ricardo From taj at www.linux.org.uk Tue Apr 5 00:48:12 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 07:48:12 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42515A83.4050907@emation.pt> References: <42515A83.4050907@emation.pt> Message-ID: On Mon, 4 Apr 2005, Ricardo Trindade wrote: > Hi, > > I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most > recent stable snapshot), and get the following exception : > > It looks like rxtx has been compiled with jdk 1.5. If this was > indeed the case, I think there is a compilation flag that generates code > that runs on older jdks. > > java.lang.UnsupportedClassVersionError: > gnu/io/UnsupportedCommOperationException (Unsupported major.minor > version 49.0) [snip] Thanks Ricardo I recompiled the jar with javac -source 1.3 -target 1.3. That should cover most of the JRE's in use today. I also compiled the rxtx 2.0 x86_64 native library which appeared to be missing. I tried looking for flags to pass gcc 4.0 to make the native libraries more backwards compatible but only found options for C++ which is not used in rxtx. I've got a list of other bugs that I'll be going through in the next few weeks but for now I just left them with the same CVS filename - no code changes. ftp://ftp.qbang.org/pub/rxtx/rxtx-2.0-CVS-20050120-bins.tar.gz ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-CVS-20050120-bins.tar.gz -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Tue Apr 5 02:24:33 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 05 Apr 2005 09:24:33 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: References: <42515A83.4050907@emation.pt> Message-ID: <42524B41.3040300@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050405/5919abbb/attachment-0063.html From taj at www.linux.org.uk Tue Apr 5 03:00:29 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 10:00:29 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42524B41.3040300@emation.pt> References: <42515A83.4050907@emation.pt> <42524B41.3040300@emation.pt> Message-ID: On Tue, 5 Apr 2005, Ricardo Trindade wrote: > Will you anounce to the list when a new release is available ? > There will be several incremental releases announced here. Once those are done, we will release 2.1.7 and 2.0.7. -- Trent Jarvi taj at www.linux.org.uk From no_spam at somewhere.com Tue Apr 5 11:55:37 2005 From: no_spam at somewhere.com (no_spam@somewhere.com) Date: Tue, 5 Apr 2005 13:55:37 -0400 Subject: [Rxtx] Closing a port from an event listener results in a deadlock Message-ID: <20050405175537.GA21747@rcog.homelinux.net> On the message I sent on March 14, does anyone had the chance to try the modification? Or was it already fixed? (I haven't searched the archive extensively) Or maybe my message got catched by some spam filters? (it made it to the list archive though) Anyway, I would appreciate some feedback (through the list) Thanks From taj at www.linux.org.uk Tue Apr 5 14:42:28 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 21:42:28 +0100 (BST) Subject: [Rxtx] Closing a port from an event listener results in a deadlock In-Reply-To: <20050405175537.GA21747@rcog.homelinux.net> References: <20050405175537.GA21747@rcog.homelinux.net> Message-ID: On Tue, 5 Apr 2005 no_spam at somewhere.com wrote: > On the message I sent on March 14, does anyone had the chance to try the > modification? > > Or was it already fixed? (I haven't searched the archive extensively) > > Or maybe my message got catched by some spam filters? (it made it to the list > archive though) > > Anyway, I would appreciate some feedback (through the list) > The patch is here http://marc.theaimsgroup.com/?l=rxtx&m=111084488820288&w=2 I have applied this patch to a local copy but will not be doing formal testing for a couple weeks. I do not try to close ports from inside the eventListenter usually so I encourage any feedback also. If there are no problems reported, I expect this will go into rxtx 2.1-7. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Wed Apr 6 08:33:42 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Wed, 06 Apr 2005 15:33:42 +0100 Subject: [Rxtx] getting RXTX version Message-ID: <4253F346.50102@emation.pt> Hi, I want to make sure my deployments have the same version of RXTX jar and native lib. I know the version of the jar can be obtained in the Version class, but how can I obtain the native version ? I know RXTX prints to the console a warning if the version is different. Is there a way to programatically know is this is the case ? I would like to log that to our app's log thanks Ricardo From taj at www.linux.org.uk Wed Apr 6 15:10:20 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 6 Apr 2005 22:10:20 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4253F346.50102@emation.pt> References: <4253F346.50102@emation.pt> Message-ID: On Wed, 6 Apr 2005, Ricardo Trindade wrote: > Hi, > > I want to make sure my deployments have the same version of RXTX jar > and native lib. > > I know the version of the jar can be obtained in the Version class, > but how can I obtain the native version ? > > I know RXTX prints to the console a warning if the version is > different. Is there a way to programatically know is this is the case ? > > I would like to log that to our app's log > There isn't a suggested way of doing that right now. We could move things around and have a static String RXTXVersion.getNativeVersion() in future releases. Is this what you expected? This is not documented in commapi at all. I just tossed that in to catch conflicts while developing. It would be nice to have access in GUI applications though. It may be possible to access RXTXCommDriver.LibVersion right now. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Thu Apr 7 02:51:00 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 09:51:00 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> Message-ID: <4254F474.7020905@emation.pt> >There isn't a suggested way of doing that right now. We could move things >around and have a static String RXTXVersion.getNativeVersion() in future >releases. Is this what you expected? > > Yes, that would be perfect. >This is not documented in commapi at all. I just tossed that in to catch >conflicts while developing. It would be nice to have access in GUI >applications though. > >It may be possible to access RXTXCommDriver.LibVersion right now. > > > I tried, and I don't think it's possible. From taj at www.linux.org.uk Thu Apr 7 03:32:04 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 7 Apr 2005 10:32:04 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4254F474.7020905@emation.pt> References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: On Thu, 7 Apr 2005, Ricardo Trindade wrote: > > >There isn't a suggested way of doing that right now. We could move things > >around and have a static String RXTXVersion.getNativeVersion() in future > >releases. Is this what you expected? > > > > > > Yes, that would be perfect. > The attached should do what you want. You will still need to catch an exception for older versions... -- Trent Jarvi taj at www.linux.org.uk -------------- next part -------------- ? public_version.patch Index: RXTXCommDriver.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXCommDriver.java,v retrieving revision 1.16.2.51 diff -u -r1.16.2.51 RXTXCommDriver.java --- RXTXCommDriver.java 12 Oct 2004 09:13:30 -0000 1.16.2.51 +++ RXTXCommDriver.java 7 Apr 2005 09:29:04 -0000 @@ -54,7 +54,7 @@ the Library. */ String JarVersion = RXTXVersion.getVersion(); - String LibVersion = nativeGetVersion(); + String LibVersion = RXTXVersion.nativeGetVersion(); if ( devel ) { System.out.println("Devel Library"); @@ -76,7 +76,6 @@ /** Get the Serial port prefixes for the running OS */ private String deviceDirectory; private String osName; - private static native String nativeGetVersion(); private native boolean registerKnownPorts(int PortType); private native boolean isPortPrefixValid(String dev); private native boolean testRead(String dev, int type); Index: RXTXVersion.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXVersion.java,v retrieving revision 1.2.2.31 diff -u -r1.2.2.31 RXTXVersion.java --- RXTXVersion.java 16 Oct 2004 16:20:35 -0000 1.2.2.31 +++ RXTXVersion.java 7 Apr 2005 09:29:04 -0000 @@ -36,6 +36,7 @@ private static String Version; static { + System.loadLibrary( "rxtxSerial" ); Version = "RXTX-2.1-7pre20"; } /** @@ -47,4 +48,5 @@ { return(Version); } + public static native String nativeGetVersion(); } Index: SerialImp.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v retrieving revision 1.46.2.181 diff -u -r1.46.2.181 SerialImp.c --- SerialImp.c 17 Oct 2004 09:48:56 -0000 1.46.2.181 +++ SerialImp.c 7 Apr 2005 09:29:07 -0000 @@ -116,6 +116,7 @@ * It will eventually be removed. * */ #define RXTXPort(foo) Java_gnu_io_RXTXPort_ ## foo +#define RXTXVersion(foo) Java_gnu_io_RXTXVersion_ ## foo #define RXTXCommDriver(foo) Java_gnu_io_RXTXCommDriver_ ## foo #if defined(__sun__) || defined(__hpux__) @@ -4001,7 +4002,7 @@ } /*---------------------------------------------------------- -RXTXCommDriver.nativeGetVersion +RXTXVersion.nativeGetVersion accept: none perform: return the current version @@ -4010,9 +4011,10 @@ comments: This is used to avoid mixing versions of the .jar and native library. First introduced in rxtx-1.5-9 + Moved from RXTXCommDriver to RXTXVersion in rxtx-2.1-7 ----------------------------------------------------------*/ -JNIEXPORT jstring JNICALL RXTXCommDriver(nativeGetVersion) (JNIEnv *env, +JNIEXPORT jstring JNICALL RXTXVersion(nativeGetVersion) (JNIEnv *env, jclass jclazz ) { return (*env)->NewStringUTF( env, "RXTX-2.1-7pre20" ); From ricardo.trindade at emation.pt Thu Apr 7 03:45:58 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 10:45:58 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: <42550156.2040908@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050407/05212451/attachment-0063.html From thomas.shulok at lmco.com Thu Apr 7 17:43:11 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Thu, 07 Apr 2005 19:43:11 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi There, I'm attempting to talk RS232 between an embedded Linux box and a Windows box. Everything connects up fine, and I can send and receive a simple sequence of bytes with no problems. However, if around 5 seconds goes by without me sending something, I get the following when I attempt to send. java.io.IOException: Input/output error in writeArray Stack trace: java/lang/Throwable.()V java/lang/Throwable.(Ljava/lang/String;)V java/io/IOException.(Ljava/lang/String;)V gnu/io/RXTXPort.writeArray([BIIZ)V gnu/io/RXTXPort$SerialOutputStream.write([B)V SerialTest.main([Ljava/lang/String;)V If there interval is shorter (say 2 seconds between sends), I have no problems. On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and librxtxSerial-2.0.7pre2.so. Any ideas? Thanks, Thom -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5b23dcf/attachment-0063.html From taj at www.linux.org.uk Thu Apr 7 19:22:36 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:22:36 +0100 (BST) Subject: [Rxtx] Input/output error in writeArray In-Reply-To: References: Message-ID: On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a Windows > box. Everything connects up fine, and I can send and receive a simple > sequence of bytes with no problems. However, if around 5 seconds goes > by without me sending something, I get the following when I attempt to > send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Apr 7 19:24:59 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:24:59 +0100 (BST) Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) Message-ID: hmm. This would not work from applets would it? -- Trent Jarvi taj at www.linux.org.uk ---------- Forwarded message ---------- Date: Thu, 07 Apr 2005 16:05:53 -0400 From: Chris Gaffney To: taj at www.linux.org.uk Subject: RXTX Libraries on Classpath fix Hi, I submitted a patch for RXTX a few weeks ago to allow for loading the native libraries from the classpath. Since sending it to you I found it wasn't working on windows. I've fixed the problem and created a new patch that should replace the older one. The actual change is a one line from a String.equals() to a String.startsWith(). Thanks for a great piece of software, -Chris Gaffney Grand Valley State University -------------- next part -------------- A non-text attachment was scrubbed... Name: libraries_on_classpath_fixed.patch Type: text/x-patch Size: 5617 bytes Desc: Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5d423b8/libraries_on_classpath_fixed-0063.bin From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From thomas.shulok at lmco.com Fri Apr 8 10:38:55 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Fri, 08 Apr 2005 12:38:55 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi Trent, Thanks for the prompt response. Before diving deeper, I was wondering if there is a timeout parameter somewhere in the stack that I have not set properly. Given the nature of the failure (only fails if the line has been idle for a few seconds), it feels like some kind of timeout issue... Thanks again, Thom -----Original Message----- From: rxtx-bounces at mail.linuxgrrls.org [mailto:rxtx-bounces at mail.linuxgrrls.org] On Behalf Of Trent Jarvi Sent: Thursday, April 07, 2005 6:23 PM To: Java RXTX discussion Subject: Re: [Rxtx] Input/output error in writeArray On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a > Windows box. Everything connects up fine, and I can send and receive > a simple sequence of bytes with no problems. However, if around 5 > seconds goes by without me sending something, I get the following when > I attempt to send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at mail.linuxgrrls.org http://mail.linuxgrrls.org/mailman/listinfo/rxtx From ricardo.trindade at emation.pt Mon Apr 4 09:17:23 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Mon, 04 Apr 2005 16:17:23 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot Message-ID: <42515A83.4050907@emation.pt> Hi, I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most recent stable snapshot), and get the following exception : It looks like rxtx has been compiled with jdk 1.5. If this was indeed the case, I think there is a compilation flag that generates code that runs on older jdks. java.lang.UnsupportedClassVersionError: gnu/io/UnsupportedCommOperationException (Unsupported major.minor version 49.0) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at java.net.URLClassLoader.defineClass(URLClassLoader.java:251) at java.net.URLClassLoader.access$100(URLClassLoader.java:55) at java.net.URLClassLoader$1.run(URLClassLoader.java:194) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:187) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:141) I'm trying to run it with 1.4. thanks Ricardo From taj at www.linux.org.uk Tue Apr 5 00:48:12 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 07:48:12 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42515A83.4050907@emation.pt> References: <42515A83.4050907@emation.pt> Message-ID: On Mon, 4 Apr 2005, Ricardo Trindade wrote: > Hi, > > I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most > recent stable snapshot), and get the following exception : > > It looks like rxtx has been compiled with jdk 1.5. If this was > indeed the case, I think there is a compilation flag that generates code > that runs on older jdks. > > java.lang.UnsupportedClassVersionError: > gnu/io/UnsupportedCommOperationException (Unsupported major.minor > version 49.0) [snip] Thanks Ricardo I recompiled the jar with javac -source 1.3 -target 1.3. That should cover most of the JRE's in use today. I also compiled the rxtx 2.0 x86_64 native library which appeared to be missing. I tried looking for flags to pass gcc 4.0 to make the native libraries more backwards compatible but only found options for C++ which is not used in rxtx. I've got a list of other bugs that I'll be going through in the next few weeks but for now I just left them with the same CVS filename - no code changes. ftp://ftp.qbang.org/pub/rxtx/rxtx-2.0-CVS-20050120-bins.tar.gz ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-CVS-20050120-bins.tar.gz -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Tue Apr 5 02:24:33 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 05 Apr 2005 09:24:33 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: References: <42515A83.4050907@emation.pt> Message-ID: <42524B41.3040300@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050405/5919abbb/attachment-0064.html From taj at www.linux.org.uk Tue Apr 5 03:00:29 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 10:00:29 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42524B41.3040300@emation.pt> References: <42515A83.4050907@emation.pt> <42524B41.3040300@emation.pt> Message-ID: On Tue, 5 Apr 2005, Ricardo Trindade wrote: > Will you anounce to the list when a new release is available ? > There will be several incremental releases announced here. Once those are done, we will release 2.1.7 and 2.0.7. -- Trent Jarvi taj at www.linux.org.uk From no_spam at somewhere.com Tue Apr 5 11:55:37 2005 From: no_spam at somewhere.com (no_spam@somewhere.com) Date: Tue, 5 Apr 2005 13:55:37 -0400 Subject: [Rxtx] Closing a port from an event listener results in a deadlock Message-ID: <20050405175537.GA21747@rcog.homelinux.net> On the message I sent on March 14, does anyone had the chance to try the modification? Or was it already fixed? (I haven't searched the archive extensively) Or maybe my message got catched by some spam filters? (it made it to the list archive though) Anyway, I would appreciate some feedback (through the list) Thanks From taj at www.linux.org.uk Tue Apr 5 14:42:28 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 21:42:28 +0100 (BST) Subject: [Rxtx] Closing a port from an event listener results in a deadlock In-Reply-To: <20050405175537.GA21747@rcog.homelinux.net> References: <20050405175537.GA21747@rcog.homelinux.net> Message-ID: On Tue, 5 Apr 2005 no_spam at somewhere.com wrote: > On the message I sent on March 14, does anyone had the chance to try the > modification? > > Or was it already fixed? (I haven't searched the archive extensively) > > Or maybe my message got catched by some spam filters? (it made it to the list > archive though) > > Anyway, I would appreciate some feedback (through the list) > The patch is here http://marc.theaimsgroup.com/?l=rxtx&m=111084488820288&w=2 I have applied this patch to a local copy but will not be doing formal testing for a couple weeks. I do not try to close ports from inside the eventListenter usually so I encourage any feedback also. If there are no problems reported, I expect this will go into rxtx 2.1-7. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Wed Apr 6 08:33:42 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Wed, 06 Apr 2005 15:33:42 +0100 Subject: [Rxtx] getting RXTX version Message-ID: <4253F346.50102@emation.pt> Hi, I want to make sure my deployments have the same version of RXTX jar and native lib. I know the version of the jar can be obtained in the Version class, but how can I obtain the native version ? I know RXTX prints to the console a warning if the version is different. Is there a way to programatically know is this is the case ? I would like to log that to our app's log thanks Ricardo From taj at www.linux.org.uk Wed Apr 6 15:10:20 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 6 Apr 2005 22:10:20 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4253F346.50102@emation.pt> References: <4253F346.50102@emation.pt> Message-ID: On Wed, 6 Apr 2005, Ricardo Trindade wrote: > Hi, > > I want to make sure my deployments have the same version of RXTX jar > and native lib. > > I know the version of the jar can be obtained in the Version class, > but how can I obtain the native version ? > > I know RXTX prints to the console a warning if the version is > different. Is there a way to programatically know is this is the case ? > > I would like to log that to our app's log > There isn't a suggested way of doing that right now. We could move things around and have a static String RXTXVersion.getNativeVersion() in future releases. Is this what you expected? This is not documented in commapi at all. I just tossed that in to catch conflicts while developing. It would be nice to have access in GUI applications though. It may be possible to access RXTXCommDriver.LibVersion right now. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Thu Apr 7 02:51:00 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 09:51:00 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> Message-ID: <4254F474.7020905@emation.pt> >There isn't a suggested way of doing that right now. We could move things >around and have a static String RXTXVersion.getNativeVersion() in future >releases. Is this what you expected? > > Yes, that would be perfect. >This is not documented in commapi at all. I just tossed that in to catch >conflicts while developing. It would be nice to have access in GUI >applications though. > >It may be possible to access RXTXCommDriver.LibVersion right now. > > > I tried, and I don't think it's possible. From taj at www.linux.org.uk Thu Apr 7 03:32:04 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 7 Apr 2005 10:32:04 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4254F474.7020905@emation.pt> References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: On Thu, 7 Apr 2005, Ricardo Trindade wrote: > > >There isn't a suggested way of doing that right now. We could move things > >around and have a static String RXTXVersion.getNativeVersion() in future > >releases. Is this what you expected? > > > > > > Yes, that would be perfect. > The attached should do what you want. You will still need to catch an exception for older versions... -- Trent Jarvi taj at www.linux.org.uk -------------- next part -------------- ? public_version.patch Index: RXTXCommDriver.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXCommDriver.java,v retrieving revision 1.16.2.51 diff -u -r1.16.2.51 RXTXCommDriver.java --- RXTXCommDriver.java 12 Oct 2004 09:13:30 -0000 1.16.2.51 +++ RXTXCommDriver.java 7 Apr 2005 09:29:04 -0000 @@ -54,7 +54,7 @@ the Library. */ String JarVersion = RXTXVersion.getVersion(); - String LibVersion = nativeGetVersion(); + String LibVersion = RXTXVersion.nativeGetVersion(); if ( devel ) { System.out.println("Devel Library"); @@ -76,7 +76,6 @@ /** Get the Serial port prefixes for the running OS */ private String deviceDirectory; private String osName; - private static native String nativeGetVersion(); private native boolean registerKnownPorts(int PortType); private native boolean isPortPrefixValid(String dev); private native boolean testRead(String dev, int type); Index: RXTXVersion.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXVersion.java,v retrieving revision 1.2.2.31 diff -u -r1.2.2.31 RXTXVersion.java --- RXTXVersion.java 16 Oct 2004 16:20:35 -0000 1.2.2.31 +++ RXTXVersion.java 7 Apr 2005 09:29:04 -0000 @@ -36,6 +36,7 @@ private static String Version; static { + System.loadLibrary( "rxtxSerial" ); Version = "RXTX-2.1-7pre20"; } /** @@ -47,4 +48,5 @@ { return(Version); } + public static native String nativeGetVersion(); } Index: SerialImp.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v retrieving revision 1.46.2.181 diff -u -r1.46.2.181 SerialImp.c --- SerialImp.c 17 Oct 2004 09:48:56 -0000 1.46.2.181 +++ SerialImp.c 7 Apr 2005 09:29:07 -0000 @@ -116,6 +116,7 @@ * It will eventually be removed. * */ #define RXTXPort(foo) Java_gnu_io_RXTXPort_ ## foo +#define RXTXVersion(foo) Java_gnu_io_RXTXVersion_ ## foo #define RXTXCommDriver(foo) Java_gnu_io_RXTXCommDriver_ ## foo #if defined(__sun__) || defined(__hpux__) @@ -4001,7 +4002,7 @@ } /*---------------------------------------------------------- -RXTXCommDriver.nativeGetVersion +RXTXVersion.nativeGetVersion accept: none perform: return the current version @@ -4010,9 +4011,10 @@ comments: This is used to avoid mixing versions of the .jar and native library. First introduced in rxtx-1.5-9 + Moved from RXTXCommDriver to RXTXVersion in rxtx-2.1-7 ----------------------------------------------------------*/ -JNIEXPORT jstring JNICALL RXTXCommDriver(nativeGetVersion) (JNIEnv *env, +JNIEXPORT jstring JNICALL RXTXVersion(nativeGetVersion) (JNIEnv *env, jclass jclazz ) { return (*env)->NewStringUTF( env, "RXTX-2.1-7pre20" ); From ricardo.trindade at emation.pt Thu Apr 7 03:45:58 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 10:45:58 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: <42550156.2040908@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050407/05212451/attachment-0064.html From thomas.shulok at lmco.com Thu Apr 7 17:43:11 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Thu, 07 Apr 2005 19:43:11 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi There, I'm attempting to talk RS232 between an embedded Linux box and a Windows box. Everything connects up fine, and I can send and receive a simple sequence of bytes with no problems. However, if around 5 seconds goes by without me sending something, I get the following when I attempt to send. java.io.IOException: Input/output error in writeArray Stack trace: java/lang/Throwable.()V java/lang/Throwable.(Ljava/lang/String;)V java/io/IOException.(Ljava/lang/String;)V gnu/io/RXTXPort.writeArray([BIIZ)V gnu/io/RXTXPort$SerialOutputStream.write([B)V SerialTest.main([Ljava/lang/String;)V If there interval is shorter (say 2 seconds between sends), I have no problems. On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and librxtxSerial-2.0.7pre2.so. Any ideas? Thanks, Thom -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5b23dcf/attachment-0064.html From taj at www.linux.org.uk Thu Apr 7 19:22:36 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:22:36 +0100 (BST) Subject: [Rxtx] Input/output error in writeArray In-Reply-To: References: Message-ID: On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a Windows > box. Everything connects up fine, and I can send and receive a simple > sequence of bytes with no problems. However, if around 5 seconds goes > by without me sending something, I get the following when I attempt to > send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Apr 7 19:24:59 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:24:59 +0100 (BST) Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) Message-ID: hmm. This would not work from applets would it? -- Trent Jarvi taj at www.linux.org.uk ---------- Forwarded message ---------- Date: Thu, 07 Apr 2005 16:05:53 -0400 From: Chris Gaffney To: taj at www.linux.org.uk Subject: RXTX Libraries on Classpath fix Hi, I submitted a patch for RXTX a few weeks ago to allow for loading the native libraries from the classpath. Since sending it to you I found it wasn't working on windows. I've fixed the problem and created a new patch that should replace the older one. The actual change is a one line from a String.equals() to a String.startsWith(). Thanks for a great piece of software, -Chris Gaffney Grand Valley State University -------------- next part -------------- A non-text attachment was scrubbed... Name: libraries_on_classpath_fixed.patch Type: text/x-patch Size: 5617 bytes Desc: Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5d423b8/libraries_on_classpath_fixed-0064.bin From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From thomas.shulok at lmco.com Fri Apr 8 10:38:55 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Fri, 08 Apr 2005 12:38:55 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi Trent, Thanks for the prompt response. Before diving deeper, I was wondering if there is a timeout parameter somewhere in the stack that I have not set properly. Given the nature of the failure (only fails if the line has been idle for a few seconds), it feels like some kind of timeout issue... Thanks again, Thom -----Original Message----- From: rxtx-bounces at mail.linuxgrrls.org [mailto:rxtx-bounces at mail.linuxgrrls.org] On Behalf Of Trent Jarvi Sent: Thursday, April 07, 2005 6:23 PM To: Java RXTX discussion Subject: Re: [Rxtx] Input/output error in writeArray On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a > Windows box. Everything connects up fine, and I can send and receive > a simple sequence of bytes with no problems. However, if around 5 > seconds goes by without me sending something, I get the following when > I attempt to send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at mail.linuxgrrls.org http://mail.linuxgrrls.org/mailman/listinfo/rxtx From ricardo.trindade at emation.pt Mon Apr 4 09:17:23 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Mon, 04 Apr 2005 16:17:23 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot Message-ID: <42515A83.4050907@emation.pt> Hi, I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most recent stable snapshot), and get the following exception : It looks like rxtx has been compiled with jdk 1.5. If this was indeed the case, I think there is a compilation flag that generates code that runs on older jdks. java.lang.UnsupportedClassVersionError: gnu/io/UnsupportedCommOperationException (Unsupported major.minor version 49.0) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at java.net.URLClassLoader.defineClass(URLClassLoader.java:251) at java.net.URLClassLoader.access$100(URLClassLoader.java:55) at java.net.URLClassLoader$1.run(URLClassLoader.java:194) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:187) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:141) I'm trying to run it with 1.4. thanks Ricardo From taj at www.linux.org.uk Tue Apr 5 00:48:12 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 07:48:12 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42515A83.4050907@emation.pt> References: <42515A83.4050907@emation.pt> Message-ID: On Mon, 4 Apr 2005, Ricardo Trindade wrote: > Hi, > > I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most > recent stable snapshot), and get the following exception : > > It looks like rxtx has been compiled with jdk 1.5. If this was > indeed the case, I think there is a compilation flag that generates code > that runs on older jdks. > > java.lang.UnsupportedClassVersionError: > gnu/io/UnsupportedCommOperationException (Unsupported major.minor > version 49.0) [snip] Thanks Ricardo I recompiled the jar with javac -source 1.3 -target 1.3. That should cover most of the JRE's in use today. I also compiled the rxtx 2.0 x86_64 native library which appeared to be missing. I tried looking for flags to pass gcc 4.0 to make the native libraries more backwards compatible but only found options for C++ which is not used in rxtx. I've got a list of other bugs that I'll be going through in the next few weeks but for now I just left them with the same CVS filename - no code changes. ftp://ftp.qbang.org/pub/rxtx/rxtx-2.0-CVS-20050120-bins.tar.gz ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-CVS-20050120-bins.tar.gz -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Tue Apr 5 02:24:33 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 05 Apr 2005 09:24:33 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: References: <42515A83.4050907@emation.pt> Message-ID: <42524B41.3040300@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050405/5919abbb/attachment-0065.html From taj at www.linux.org.uk Tue Apr 5 03:00:29 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 10:00:29 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42524B41.3040300@emation.pt> References: <42515A83.4050907@emation.pt> <42524B41.3040300@emation.pt> Message-ID: On Tue, 5 Apr 2005, Ricardo Trindade wrote: > Will you anounce to the list when a new release is available ? > There will be several incremental releases announced here. Once those are done, we will release 2.1.7 and 2.0.7. -- Trent Jarvi taj at www.linux.org.uk From no_spam at somewhere.com Tue Apr 5 11:55:37 2005 From: no_spam at somewhere.com (no_spam@somewhere.com) Date: Tue, 5 Apr 2005 13:55:37 -0400 Subject: [Rxtx] Closing a port from an event listener results in a deadlock Message-ID: <20050405175537.GA21747@rcog.homelinux.net> On the message I sent on March 14, does anyone had the chance to try the modification? Or was it already fixed? (I haven't searched the archive extensively) Or maybe my message got catched by some spam filters? (it made it to the list archive though) Anyway, I would appreciate some feedback (through the list) Thanks From taj at www.linux.org.uk Tue Apr 5 14:42:28 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 21:42:28 +0100 (BST) Subject: [Rxtx] Closing a port from an event listener results in a deadlock In-Reply-To: <20050405175537.GA21747@rcog.homelinux.net> References: <20050405175537.GA21747@rcog.homelinux.net> Message-ID: On Tue, 5 Apr 2005 no_spam at somewhere.com wrote: > On the message I sent on March 14, does anyone had the chance to try the > modification? > > Or was it already fixed? (I haven't searched the archive extensively) > > Or maybe my message got catched by some spam filters? (it made it to the list > archive though) > > Anyway, I would appreciate some feedback (through the list) > The patch is here http://marc.theaimsgroup.com/?l=rxtx&m=111084488820288&w=2 I have applied this patch to a local copy but will not be doing formal testing for a couple weeks. I do not try to close ports from inside the eventListenter usually so I encourage any feedback also. If there are no problems reported, I expect this will go into rxtx 2.1-7. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Wed Apr 6 08:33:42 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Wed, 06 Apr 2005 15:33:42 +0100 Subject: [Rxtx] getting RXTX version Message-ID: <4253F346.50102@emation.pt> Hi, I want to make sure my deployments have the same version of RXTX jar and native lib. I know the version of the jar can be obtained in the Version class, but how can I obtain the native version ? I know RXTX prints to the console a warning if the version is different. Is there a way to programatically know is this is the case ? I would like to log that to our app's log thanks Ricardo From taj at www.linux.org.uk Wed Apr 6 15:10:20 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 6 Apr 2005 22:10:20 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4253F346.50102@emation.pt> References: <4253F346.50102@emation.pt> Message-ID: On Wed, 6 Apr 2005, Ricardo Trindade wrote: > Hi, > > I want to make sure my deployments have the same version of RXTX jar > and native lib. > > I know the version of the jar can be obtained in the Version class, > but how can I obtain the native version ? > > I know RXTX prints to the console a warning if the version is > different. Is there a way to programatically know is this is the case ? > > I would like to log that to our app's log > There isn't a suggested way of doing that right now. We could move things around and have a static String RXTXVersion.getNativeVersion() in future releases. Is this what you expected? This is not documented in commapi at all. I just tossed that in to catch conflicts while developing. It would be nice to have access in GUI applications though. It may be possible to access RXTXCommDriver.LibVersion right now. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Thu Apr 7 02:51:00 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 09:51:00 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> Message-ID: <4254F474.7020905@emation.pt> >There isn't a suggested way of doing that right now. We could move things >around and have a static String RXTXVersion.getNativeVersion() in future >releases. Is this what you expected? > > Yes, that would be perfect. >This is not documented in commapi at all. I just tossed that in to catch >conflicts while developing. It would be nice to have access in GUI >applications though. > >It may be possible to access RXTXCommDriver.LibVersion right now. > > > I tried, and I don't think it's possible. From taj at www.linux.org.uk Thu Apr 7 03:32:04 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 7 Apr 2005 10:32:04 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4254F474.7020905@emation.pt> References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: On Thu, 7 Apr 2005, Ricardo Trindade wrote: > > >There isn't a suggested way of doing that right now. We could move things > >around and have a static String RXTXVersion.getNativeVersion() in future > >releases. Is this what you expected? > > > > > > Yes, that would be perfect. > The attached should do what you want. You will still need to catch an exception for older versions... -- Trent Jarvi taj at www.linux.org.uk -------------- next part -------------- ? public_version.patch Index: RXTXCommDriver.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXCommDriver.java,v retrieving revision 1.16.2.51 diff -u -r1.16.2.51 RXTXCommDriver.java --- RXTXCommDriver.java 12 Oct 2004 09:13:30 -0000 1.16.2.51 +++ RXTXCommDriver.java 7 Apr 2005 09:29:04 -0000 @@ -54,7 +54,7 @@ the Library. */ String JarVersion = RXTXVersion.getVersion(); - String LibVersion = nativeGetVersion(); + String LibVersion = RXTXVersion.nativeGetVersion(); if ( devel ) { System.out.println("Devel Library"); @@ -76,7 +76,6 @@ /** Get the Serial port prefixes for the running OS */ private String deviceDirectory; private String osName; - private static native String nativeGetVersion(); private native boolean registerKnownPorts(int PortType); private native boolean isPortPrefixValid(String dev); private native boolean testRead(String dev, int type); Index: RXTXVersion.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXVersion.java,v retrieving revision 1.2.2.31 diff -u -r1.2.2.31 RXTXVersion.java --- RXTXVersion.java 16 Oct 2004 16:20:35 -0000 1.2.2.31 +++ RXTXVersion.java 7 Apr 2005 09:29:04 -0000 @@ -36,6 +36,7 @@ private static String Version; static { + System.loadLibrary( "rxtxSerial" ); Version = "RXTX-2.1-7pre20"; } /** @@ -47,4 +48,5 @@ { return(Version); } + public static native String nativeGetVersion(); } Index: SerialImp.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v retrieving revision 1.46.2.181 diff -u -r1.46.2.181 SerialImp.c --- SerialImp.c 17 Oct 2004 09:48:56 -0000 1.46.2.181 +++ SerialImp.c 7 Apr 2005 09:29:07 -0000 @@ -116,6 +116,7 @@ * It will eventually be removed. * */ #define RXTXPort(foo) Java_gnu_io_RXTXPort_ ## foo +#define RXTXVersion(foo) Java_gnu_io_RXTXVersion_ ## foo #define RXTXCommDriver(foo) Java_gnu_io_RXTXCommDriver_ ## foo #if defined(__sun__) || defined(__hpux__) @@ -4001,7 +4002,7 @@ } /*---------------------------------------------------------- -RXTXCommDriver.nativeGetVersion +RXTXVersion.nativeGetVersion accept: none perform: return the current version @@ -4010,9 +4011,10 @@ comments: This is used to avoid mixing versions of the .jar and native library. First introduced in rxtx-1.5-9 + Moved from RXTXCommDriver to RXTXVersion in rxtx-2.1-7 ----------------------------------------------------------*/ -JNIEXPORT jstring JNICALL RXTXCommDriver(nativeGetVersion) (JNIEnv *env, +JNIEXPORT jstring JNICALL RXTXVersion(nativeGetVersion) (JNIEnv *env, jclass jclazz ) { return (*env)->NewStringUTF( env, "RXTX-2.1-7pre20" ); From ricardo.trindade at emation.pt Thu Apr 7 03:45:58 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 10:45:58 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: <42550156.2040908@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050407/05212451/attachment-0065.html From thomas.shulok at lmco.com Thu Apr 7 17:43:11 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Thu, 07 Apr 2005 19:43:11 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi There, I'm attempting to talk RS232 between an embedded Linux box and a Windows box. Everything connects up fine, and I can send and receive a simple sequence of bytes with no problems. However, if around 5 seconds goes by without me sending something, I get the following when I attempt to send. java.io.IOException: Input/output error in writeArray Stack trace: java/lang/Throwable.()V java/lang/Throwable.(Ljava/lang/String;)V java/io/IOException.(Ljava/lang/String;)V gnu/io/RXTXPort.writeArray([BIIZ)V gnu/io/RXTXPort$SerialOutputStream.write([B)V SerialTest.main([Ljava/lang/String;)V If there interval is shorter (say 2 seconds between sends), I have no problems. On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and librxtxSerial-2.0.7pre2.so. Any ideas? Thanks, Thom -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5b23dcf/attachment-0065.html From taj at www.linux.org.uk Thu Apr 7 19:22:36 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:22:36 +0100 (BST) Subject: [Rxtx] Input/output error in writeArray In-Reply-To: References: Message-ID: On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a Windows > box. Everything connects up fine, and I can send and receive a simple > sequence of bytes with no problems. However, if around 5 seconds goes > by without me sending something, I get the following when I attempt to > send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Apr 7 19:24:59 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:24:59 +0100 (BST) Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) Message-ID: hmm. This would not work from applets would it? -- Trent Jarvi taj at www.linux.org.uk ---------- Forwarded message ---------- Date: Thu, 07 Apr 2005 16:05:53 -0400 From: Chris Gaffney To: taj at www.linux.org.uk Subject: RXTX Libraries on Classpath fix Hi, I submitted a patch for RXTX a few weeks ago to allow for loading the native libraries from the classpath. Since sending it to you I found it wasn't working on windows. I've fixed the problem and created a new patch that should replace the older one. The actual change is a one line from a String.equals() to a String.startsWith(). Thanks for a great piece of software, -Chris Gaffney Grand Valley State University -------------- next part -------------- A non-text attachment was scrubbed... Name: libraries_on_classpath_fixed.patch Type: text/x-patch Size: 5617 bytes Desc: Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5d423b8/libraries_on_classpath_fixed-0065.bin From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From thomas.shulok at lmco.com Fri Apr 8 10:38:55 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Fri, 08 Apr 2005 12:38:55 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi Trent, Thanks for the prompt response. Before diving deeper, I was wondering if there is a timeout parameter somewhere in the stack that I have not set properly. Given the nature of the failure (only fails if the line has been idle for a few seconds), it feels like some kind of timeout issue... Thanks again, Thom -----Original Message----- From: rxtx-bounces at mail.linuxgrrls.org [mailto:rxtx-bounces at mail.linuxgrrls.org] On Behalf Of Trent Jarvi Sent: Thursday, April 07, 2005 6:23 PM To: Java RXTX discussion Subject: Re: [Rxtx] Input/output error in writeArray On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a > Windows box. Everything connects up fine, and I can send and receive > a simple sequence of bytes with no problems. However, if around 5 > seconds goes by without me sending something, I get the following when > I attempt to send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at mail.linuxgrrls.org http://mail.linuxgrrls.org/mailman/listinfo/rxtx From ricardo.trindade at emation.pt Mon Apr 4 09:17:23 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Mon, 04 Apr 2005 16:17:23 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot Message-ID: <42515A83.4050907@emation.pt> Hi, I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most recent stable snapshot), and get the following exception : It looks like rxtx has been compiled with jdk 1.5. If this was indeed the case, I think there is a compilation flag that generates code that runs on older jdks. java.lang.UnsupportedClassVersionError: gnu/io/UnsupportedCommOperationException (Unsupported major.minor version 49.0) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at java.net.URLClassLoader.defineClass(URLClassLoader.java:251) at java.net.URLClassLoader.access$100(URLClassLoader.java:55) at java.net.URLClassLoader$1.run(URLClassLoader.java:194) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:187) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:141) I'm trying to run it with 1.4. thanks Ricardo From taj at www.linux.org.uk Tue Apr 5 00:48:12 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 07:48:12 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42515A83.4050907@emation.pt> References: <42515A83.4050907@emation.pt> Message-ID: On Mon, 4 Apr 2005, Ricardo Trindade wrote: > Hi, > > I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most > recent stable snapshot), and get the following exception : > > It looks like rxtx has been compiled with jdk 1.5. If this was > indeed the case, I think there is a compilation flag that generates code > that runs on older jdks. > > java.lang.UnsupportedClassVersionError: > gnu/io/UnsupportedCommOperationException (Unsupported major.minor > version 49.0) [snip] Thanks Ricardo I recompiled the jar with javac -source 1.3 -target 1.3. That should cover most of the JRE's in use today. I also compiled the rxtx 2.0 x86_64 native library which appeared to be missing. I tried looking for flags to pass gcc 4.0 to make the native libraries more backwards compatible but only found options for C++ which is not used in rxtx. I've got a list of other bugs that I'll be going through in the next few weeks but for now I just left them with the same CVS filename - no code changes. ftp://ftp.qbang.org/pub/rxtx/rxtx-2.0-CVS-20050120-bins.tar.gz ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-CVS-20050120-bins.tar.gz -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Tue Apr 5 02:24:33 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 05 Apr 2005 09:24:33 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: References: <42515A83.4050907@emation.pt> Message-ID: <42524B41.3040300@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050405/5919abbb/attachment-0066.html From taj at www.linux.org.uk Tue Apr 5 03:00:29 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 10:00:29 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42524B41.3040300@emation.pt> References: <42515A83.4050907@emation.pt> <42524B41.3040300@emation.pt> Message-ID: On Tue, 5 Apr 2005, Ricardo Trindade wrote: > Will you anounce to the list when a new release is available ? > There will be several incremental releases announced here. Once those are done, we will release 2.1.7 and 2.0.7. -- Trent Jarvi taj at www.linux.org.uk From no_spam at somewhere.com Tue Apr 5 11:55:37 2005 From: no_spam at somewhere.com (no_spam@somewhere.com) Date: Tue, 5 Apr 2005 13:55:37 -0400 Subject: [Rxtx] Closing a port from an event listener results in a deadlock Message-ID: <20050405175537.GA21747@rcog.homelinux.net> On the message I sent on March 14, does anyone had the chance to try the modification? Or was it already fixed? (I haven't searched the archive extensively) Or maybe my message got catched by some spam filters? (it made it to the list archive though) Anyway, I would appreciate some feedback (through the list) Thanks From taj at www.linux.org.uk Tue Apr 5 14:42:28 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 21:42:28 +0100 (BST) Subject: [Rxtx] Closing a port from an event listener results in a deadlock In-Reply-To: <20050405175537.GA21747@rcog.homelinux.net> References: <20050405175537.GA21747@rcog.homelinux.net> Message-ID: On Tue, 5 Apr 2005 no_spam at somewhere.com wrote: > On the message I sent on March 14, does anyone had the chance to try the > modification? > > Or was it already fixed? (I haven't searched the archive extensively) > > Or maybe my message got catched by some spam filters? (it made it to the list > archive though) > > Anyway, I would appreciate some feedback (through the list) > The patch is here http://marc.theaimsgroup.com/?l=rxtx&m=111084488820288&w=2 I have applied this patch to a local copy but will not be doing formal testing for a couple weeks. I do not try to close ports from inside the eventListenter usually so I encourage any feedback also. If there are no problems reported, I expect this will go into rxtx 2.1-7. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Wed Apr 6 08:33:42 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Wed, 06 Apr 2005 15:33:42 +0100 Subject: [Rxtx] getting RXTX version Message-ID: <4253F346.50102@emation.pt> Hi, I want to make sure my deployments have the same version of RXTX jar and native lib. I know the version of the jar can be obtained in the Version class, but how can I obtain the native version ? I know RXTX prints to the console a warning if the version is different. Is there a way to programatically know is this is the case ? I would like to log that to our app's log thanks Ricardo From taj at www.linux.org.uk Wed Apr 6 15:10:20 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 6 Apr 2005 22:10:20 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4253F346.50102@emation.pt> References: <4253F346.50102@emation.pt> Message-ID: On Wed, 6 Apr 2005, Ricardo Trindade wrote: > Hi, > > I want to make sure my deployments have the same version of RXTX jar > and native lib. > > I know the version of the jar can be obtained in the Version class, > but how can I obtain the native version ? > > I know RXTX prints to the console a warning if the version is > different. Is there a way to programatically know is this is the case ? > > I would like to log that to our app's log > There isn't a suggested way of doing that right now. We could move things around and have a static String RXTXVersion.getNativeVersion() in future releases. Is this what you expected? This is not documented in commapi at all. I just tossed that in to catch conflicts while developing. It would be nice to have access in GUI applications though. It may be possible to access RXTXCommDriver.LibVersion right now. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Thu Apr 7 02:51:00 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 09:51:00 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> Message-ID: <4254F474.7020905@emation.pt> >There isn't a suggested way of doing that right now. We could move things >around and have a static String RXTXVersion.getNativeVersion() in future >releases. Is this what you expected? > > Yes, that would be perfect. >This is not documented in commapi at all. I just tossed that in to catch >conflicts while developing. It would be nice to have access in GUI >applications though. > >It may be possible to access RXTXCommDriver.LibVersion right now. > > > I tried, and I don't think it's possible. From taj at www.linux.org.uk Thu Apr 7 03:32:04 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 7 Apr 2005 10:32:04 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4254F474.7020905@emation.pt> References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: On Thu, 7 Apr 2005, Ricardo Trindade wrote: > > >There isn't a suggested way of doing that right now. We could move things > >around and have a static String RXTXVersion.getNativeVersion() in future > >releases. Is this what you expected? > > > > > > Yes, that would be perfect. > The attached should do what you want. You will still need to catch an exception for older versions... -- Trent Jarvi taj at www.linux.org.uk -------------- next part -------------- ? public_version.patch Index: RXTXCommDriver.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXCommDriver.java,v retrieving revision 1.16.2.51 diff -u -r1.16.2.51 RXTXCommDriver.java --- RXTXCommDriver.java 12 Oct 2004 09:13:30 -0000 1.16.2.51 +++ RXTXCommDriver.java 7 Apr 2005 09:29:04 -0000 @@ -54,7 +54,7 @@ the Library. */ String JarVersion = RXTXVersion.getVersion(); - String LibVersion = nativeGetVersion(); + String LibVersion = RXTXVersion.nativeGetVersion(); if ( devel ) { System.out.println("Devel Library"); @@ -76,7 +76,6 @@ /** Get the Serial port prefixes for the running OS */ private String deviceDirectory; private String osName; - private static native String nativeGetVersion(); private native boolean registerKnownPorts(int PortType); private native boolean isPortPrefixValid(String dev); private native boolean testRead(String dev, int type); Index: RXTXVersion.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXVersion.java,v retrieving revision 1.2.2.31 diff -u -r1.2.2.31 RXTXVersion.java --- RXTXVersion.java 16 Oct 2004 16:20:35 -0000 1.2.2.31 +++ RXTXVersion.java 7 Apr 2005 09:29:04 -0000 @@ -36,6 +36,7 @@ private static String Version; static { + System.loadLibrary( "rxtxSerial" ); Version = "RXTX-2.1-7pre20"; } /** @@ -47,4 +48,5 @@ { return(Version); } + public static native String nativeGetVersion(); } Index: SerialImp.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v retrieving revision 1.46.2.181 diff -u -r1.46.2.181 SerialImp.c --- SerialImp.c 17 Oct 2004 09:48:56 -0000 1.46.2.181 +++ SerialImp.c 7 Apr 2005 09:29:07 -0000 @@ -116,6 +116,7 @@ * It will eventually be removed. * */ #define RXTXPort(foo) Java_gnu_io_RXTXPort_ ## foo +#define RXTXVersion(foo) Java_gnu_io_RXTXVersion_ ## foo #define RXTXCommDriver(foo) Java_gnu_io_RXTXCommDriver_ ## foo #if defined(__sun__) || defined(__hpux__) @@ -4001,7 +4002,7 @@ } /*---------------------------------------------------------- -RXTXCommDriver.nativeGetVersion +RXTXVersion.nativeGetVersion accept: none perform: return the current version @@ -4010,9 +4011,10 @@ comments: This is used to avoid mixing versions of the .jar and native library. First introduced in rxtx-1.5-9 + Moved from RXTXCommDriver to RXTXVersion in rxtx-2.1-7 ----------------------------------------------------------*/ -JNIEXPORT jstring JNICALL RXTXCommDriver(nativeGetVersion) (JNIEnv *env, +JNIEXPORT jstring JNICALL RXTXVersion(nativeGetVersion) (JNIEnv *env, jclass jclazz ) { return (*env)->NewStringUTF( env, "RXTX-2.1-7pre20" ); From ricardo.trindade at emation.pt Thu Apr 7 03:45:58 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 10:45:58 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: <42550156.2040908@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050407/05212451/attachment-0066.html From thomas.shulok at lmco.com Thu Apr 7 17:43:11 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Thu, 07 Apr 2005 19:43:11 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi There, I'm attempting to talk RS232 between an embedded Linux box and a Windows box. Everything connects up fine, and I can send and receive a simple sequence of bytes with no problems. However, if around 5 seconds goes by without me sending something, I get the following when I attempt to send. java.io.IOException: Input/output error in writeArray Stack trace: java/lang/Throwable.()V java/lang/Throwable.(Ljava/lang/String;)V java/io/IOException.(Ljava/lang/String;)V gnu/io/RXTXPort.writeArray([BIIZ)V gnu/io/RXTXPort$SerialOutputStream.write([B)V SerialTest.main([Ljava/lang/String;)V If there interval is shorter (say 2 seconds between sends), I have no problems. On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and librxtxSerial-2.0.7pre2.so. Any ideas? Thanks, Thom -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5b23dcf/attachment-0066.html From taj at www.linux.org.uk Thu Apr 7 19:22:36 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:22:36 +0100 (BST) Subject: [Rxtx] Input/output error in writeArray In-Reply-To: References: Message-ID: On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a Windows > box. Everything connects up fine, and I can send and receive a simple > sequence of bytes with no problems. However, if around 5 seconds goes > by without me sending something, I get the following when I attempt to > send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Apr 7 19:24:59 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:24:59 +0100 (BST) Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) Message-ID: hmm. This would not work from applets would it? -- Trent Jarvi taj at www.linux.org.uk ---------- Forwarded message ---------- Date: Thu, 07 Apr 2005 16:05:53 -0400 From: Chris Gaffney To: taj at www.linux.org.uk Subject: RXTX Libraries on Classpath fix Hi, I submitted a patch for RXTX a few weeks ago to allow for loading the native libraries from the classpath. Since sending it to you I found it wasn't working on windows. I've fixed the problem and created a new patch that should replace the older one. The actual change is a one line from a String.equals() to a String.startsWith(). Thanks for a great piece of software, -Chris Gaffney Grand Valley State University -------------- next part -------------- A non-text attachment was scrubbed... Name: libraries_on_classpath_fixed.patch Type: text/x-patch Size: 5617 bytes Desc: Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5d423b8/libraries_on_classpath_fixed-0066.bin From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From thomas.shulok at lmco.com Fri Apr 8 10:38:55 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Fri, 08 Apr 2005 12:38:55 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi Trent, Thanks for the prompt response. Before diving deeper, I was wondering if there is a timeout parameter somewhere in the stack that I have not set properly. Given the nature of the failure (only fails if the line has been idle for a few seconds), it feels like some kind of timeout issue... Thanks again, Thom -----Original Message----- From: rxtx-bounces at mail.linuxgrrls.org [mailto:rxtx-bounces at mail.linuxgrrls.org] On Behalf Of Trent Jarvi Sent: Thursday, April 07, 2005 6:23 PM To: Java RXTX discussion Subject: Re: [Rxtx] Input/output error in writeArray On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a > Windows box. Everything connects up fine, and I can send and receive > a simple sequence of bytes with no problems. However, if around 5 > seconds goes by without me sending something, I get the following when > I attempt to send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at mail.linuxgrrls.org http://mail.linuxgrrls.org/mailman/listinfo/rxtx From ricardo.trindade at emation.pt Mon Apr 4 09:17:23 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Mon, 04 Apr 2005 16:17:23 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot Message-ID: <42515A83.4050907@emation.pt> Hi, I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most recent stable snapshot), and get the following exception : It looks like rxtx has been compiled with jdk 1.5. If this was indeed the case, I think there is a compilation flag that generates code that runs on older jdks. java.lang.UnsupportedClassVersionError: gnu/io/UnsupportedCommOperationException (Unsupported major.minor version 49.0) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at java.net.URLClassLoader.defineClass(URLClassLoader.java:251) at java.net.URLClassLoader.access$100(URLClassLoader.java:55) at java.net.URLClassLoader$1.run(URLClassLoader.java:194) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:187) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:141) I'm trying to run it with 1.4. thanks Ricardo From taj at www.linux.org.uk Tue Apr 5 00:48:12 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 07:48:12 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42515A83.4050907@emation.pt> References: <42515A83.4050907@emation.pt> Message-ID: On Mon, 4 Apr 2005, Ricardo Trindade wrote: > Hi, > > I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most > recent stable snapshot), and get the following exception : > > It looks like rxtx has been compiled with jdk 1.5. If this was > indeed the case, I think there is a compilation flag that generates code > that runs on older jdks. > > java.lang.UnsupportedClassVersionError: > gnu/io/UnsupportedCommOperationException (Unsupported major.minor > version 49.0) [snip] Thanks Ricardo I recompiled the jar with javac -source 1.3 -target 1.3. That should cover most of the JRE's in use today. I also compiled the rxtx 2.0 x86_64 native library which appeared to be missing. I tried looking for flags to pass gcc 4.0 to make the native libraries more backwards compatible but only found options for C++ which is not used in rxtx. I've got a list of other bugs that I'll be going through in the next few weeks but for now I just left them with the same CVS filename - no code changes. ftp://ftp.qbang.org/pub/rxtx/rxtx-2.0-CVS-20050120-bins.tar.gz ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-CVS-20050120-bins.tar.gz -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Tue Apr 5 02:24:33 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 05 Apr 2005 09:24:33 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: References: <42515A83.4050907@emation.pt> Message-ID: <42524B41.3040300@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050405/5919abbb/attachment-0067.html From taj at www.linux.org.uk Tue Apr 5 03:00:29 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 10:00:29 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42524B41.3040300@emation.pt> References: <42515A83.4050907@emation.pt> <42524B41.3040300@emation.pt> Message-ID: On Tue, 5 Apr 2005, Ricardo Trindade wrote: > Will you anounce to the list when a new release is available ? > There will be several incremental releases announced here. Once those are done, we will release 2.1.7 and 2.0.7. -- Trent Jarvi taj at www.linux.org.uk From no_spam at somewhere.com Tue Apr 5 11:55:37 2005 From: no_spam at somewhere.com (no_spam@somewhere.com) Date: Tue, 5 Apr 2005 13:55:37 -0400 Subject: [Rxtx] Closing a port from an event listener results in a deadlock Message-ID: <20050405175537.GA21747@rcog.homelinux.net> On the message I sent on March 14, does anyone had the chance to try the modification? Or was it already fixed? (I haven't searched the archive extensively) Or maybe my message got catched by some spam filters? (it made it to the list archive though) Anyway, I would appreciate some feedback (through the list) Thanks From taj at www.linux.org.uk Tue Apr 5 14:42:28 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 21:42:28 +0100 (BST) Subject: [Rxtx] Closing a port from an event listener results in a deadlock In-Reply-To: <20050405175537.GA21747@rcog.homelinux.net> References: <20050405175537.GA21747@rcog.homelinux.net> Message-ID: On Tue, 5 Apr 2005 no_spam at somewhere.com wrote: > On the message I sent on March 14, does anyone had the chance to try the > modification? > > Or was it already fixed? (I haven't searched the archive extensively) > > Or maybe my message got catched by some spam filters? (it made it to the list > archive though) > > Anyway, I would appreciate some feedback (through the list) > The patch is here http://marc.theaimsgroup.com/?l=rxtx&m=111084488820288&w=2 I have applied this patch to a local copy but will not be doing formal testing for a couple weeks. I do not try to close ports from inside the eventListenter usually so I encourage any feedback also. If there are no problems reported, I expect this will go into rxtx 2.1-7. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Wed Apr 6 08:33:42 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Wed, 06 Apr 2005 15:33:42 +0100 Subject: [Rxtx] getting RXTX version Message-ID: <4253F346.50102@emation.pt> Hi, I want to make sure my deployments have the same version of RXTX jar and native lib. I know the version of the jar can be obtained in the Version class, but how can I obtain the native version ? I know RXTX prints to the console a warning if the version is different. Is there a way to programatically know is this is the case ? I would like to log that to our app's log thanks Ricardo From taj at www.linux.org.uk Wed Apr 6 15:10:20 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 6 Apr 2005 22:10:20 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4253F346.50102@emation.pt> References: <4253F346.50102@emation.pt> Message-ID: On Wed, 6 Apr 2005, Ricardo Trindade wrote: > Hi, > > I want to make sure my deployments have the same version of RXTX jar > and native lib. > > I know the version of the jar can be obtained in the Version class, > but how can I obtain the native version ? > > I know RXTX prints to the console a warning if the version is > different. Is there a way to programatically know is this is the case ? > > I would like to log that to our app's log > There isn't a suggested way of doing that right now. We could move things around and have a static String RXTXVersion.getNativeVersion() in future releases. Is this what you expected? This is not documented in commapi at all. I just tossed that in to catch conflicts while developing. It would be nice to have access in GUI applications though. It may be possible to access RXTXCommDriver.LibVersion right now. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Thu Apr 7 02:51:00 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 09:51:00 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> Message-ID: <4254F474.7020905@emation.pt> >There isn't a suggested way of doing that right now. We could move things >around and have a static String RXTXVersion.getNativeVersion() in future >releases. Is this what you expected? > > Yes, that would be perfect. >This is not documented in commapi at all. I just tossed that in to catch >conflicts while developing. It would be nice to have access in GUI >applications though. > >It may be possible to access RXTXCommDriver.LibVersion right now. > > > I tried, and I don't think it's possible. From taj at www.linux.org.uk Thu Apr 7 03:32:04 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 7 Apr 2005 10:32:04 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4254F474.7020905@emation.pt> References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: On Thu, 7 Apr 2005, Ricardo Trindade wrote: > > >There isn't a suggested way of doing that right now. We could move things > >around and have a static String RXTXVersion.getNativeVersion() in future > >releases. Is this what you expected? > > > > > > Yes, that would be perfect. > The attached should do what you want. You will still need to catch an exception for older versions... -- Trent Jarvi taj at www.linux.org.uk -------------- next part -------------- ? public_version.patch Index: RXTXCommDriver.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXCommDriver.java,v retrieving revision 1.16.2.51 diff -u -r1.16.2.51 RXTXCommDriver.java --- RXTXCommDriver.java 12 Oct 2004 09:13:30 -0000 1.16.2.51 +++ RXTXCommDriver.java 7 Apr 2005 09:29:04 -0000 @@ -54,7 +54,7 @@ the Library. */ String JarVersion = RXTXVersion.getVersion(); - String LibVersion = nativeGetVersion(); + String LibVersion = RXTXVersion.nativeGetVersion(); if ( devel ) { System.out.println("Devel Library"); @@ -76,7 +76,6 @@ /** Get the Serial port prefixes for the running OS */ private String deviceDirectory; private String osName; - private static native String nativeGetVersion(); private native boolean registerKnownPorts(int PortType); private native boolean isPortPrefixValid(String dev); private native boolean testRead(String dev, int type); Index: RXTXVersion.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXVersion.java,v retrieving revision 1.2.2.31 diff -u -r1.2.2.31 RXTXVersion.java --- RXTXVersion.java 16 Oct 2004 16:20:35 -0000 1.2.2.31 +++ RXTXVersion.java 7 Apr 2005 09:29:04 -0000 @@ -36,6 +36,7 @@ private static String Version; static { + System.loadLibrary( "rxtxSerial" ); Version = "RXTX-2.1-7pre20"; } /** @@ -47,4 +48,5 @@ { return(Version); } + public static native String nativeGetVersion(); } Index: SerialImp.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v retrieving revision 1.46.2.181 diff -u -r1.46.2.181 SerialImp.c --- SerialImp.c 17 Oct 2004 09:48:56 -0000 1.46.2.181 +++ SerialImp.c 7 Apr 2005 09:29:07 -0000 @@ -116,6 +116,7 @@ * It will eventually be removed. * */ #define RXTXPort(foo) Java_gnu_io_RXTXPort_ ## foo +#define RXTXVersion(foo) Java_gnu_io_RXTXVersion_ ## foo #define RXTXCommDriver(foo) Java_gnu_io_RXTXCommDriver_ ## foo #if defined(__sun__) || defined(__hpux__) @@ -4001,7 +4002,7 @@ } /*---------------------------------------------------------- -RXTXCommDriver.nativeGetVersion +RXTXVersion.nativeGetVersion accept: none perform: return the current version @@ -4010,9 +4011,10 @@ comments: This is used to avoid mixing versions of the .jar and native library. First introduced in rxtx-1.5-9 + Moved from RXTXCommDriver to RXTXVersion in rxtx-2.1-7 ----------------------------------------------------------*/ -JNIEXPORT jstring JNICALL RXTXCommDriver(nativeGetVersion) (JNIEnv *env, +JNIEXPORT jstring JNICALL RXTXVersion(nativeGetVersion) (JNIEnv *env, jclass jclazz ) { return (*env)->NewStringUTF( env, "RXTX-2.1-7pre20" ); From ricardo.trindade at emation.pt Thu Apr 7 03:45:58 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 10:45:58 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: <42550156.2040908@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050407/05212451/attachment-0067.html From thomas.shulok at lmco.com Thu Apr 7 17:43:11 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Thu, 07 Apr 2005 19:43:11 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi There, I'm attempting to talk RS232 between an embedded Linux box and a Windows box. Everything connects up fine, and I can send and receive a simple sequence of bytes with no problems. However, if around 5 seconds goes by without me sending something, I get the following when I attempt to send. java.io.IOException: Input/output error in writeArray Stack trace: java/lang/Throwable.()V java/lang/Throwable.(Ljava/lang/String;)V java/io/IOException.(Ljava/lang/String;)V gnu/io/RXTXPort.writeArray([BIIZ)V gnu/io/RXTXPort$SerialOutputStream.write([B)V SerialTest.main([Ljava/lang/String;)V If there interval is shorter (say 2 seconds between sends), I have no problems. On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and librxtxSerial-2.0.7pre2.so. Any ideas? Thanks, Thom -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5b23dcf/attachment-0067.html From taj at www.linux.org.uk Thu Apr 7 19:22:36 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:22:36 +0100 (BST) Subject: [Rxtx] Input/output error in writeArray In-Reply-To: References: Message-ID: On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a Windows > box. Everything connects up fine, and I can send and receive a simple > sequence of bytes with no problems. However, if around 5 seconds goes > by without me sending something, I get the following when I attempt to > send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Apr 7 19:24:59 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:24:59 +0100 (BST) Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) Message-ID: hmm. This would not work from applets would it? -- Trent Jarvi taj at www.linux.org.uk ---------- Forwarded message ---------- Date: Thu, 07 Apr 2005 16:05:53 -0400 From: Chris Gaffney To: taj at www.linux.org.uk Subject: RXTX Libraries on Classpath fix Hi, I submitted a patch for RXTX a few weeks ago to allow for loading the native libraries from the classpath. Since sending it to you I found it wasn't working on windows. I've fixed the problem and created a new patch that should replace the older one. The actual change is a one line from a String.equals() to a String.startsWith(). Thanks for a great piece of software, -Chris Gaffney Grand Valley State University -------------- next part -------------- A non-text attachment was scrubbed... Name: libraries_on_classpath_fixed.patch Type: text/x-patch Size: 5617 bytes Desc: Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5d423b8/libraries_on_classpath_fixed-0067.bin From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From thomas.shulok at lmco.com Fri Apr 8 10:38:55 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Fri, 08 Apr 2005 12:38:55 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi Trent, Thanks for the prompt response. Before diving deeper, I was wondering if there is a timeout parameter somewhere in the stack that I have not set properly. Given the nature of the failure (only fails if the line has been idle for a few seconds), it feels like some kind of timeout issue... Thanks again, Thom -----Original Message----- From: rxtx-bounces at mail.linuxgrrls.org [mailto:rxtx-bounces at mail.linuxgrrls.org] On Behalf Of Trent Jarvi Sent: Thursday, April 07, 2005 6:23 PM To: Java RXTX discussion Subject: Re: [Rxtx] Input/output error in writeArray On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a > Windows box. Everything connects up fine, and I can send and receive > a simple sequence of bytes with no problems. However, if around 5 > seconds goes by without me sending something, I get the following when > I attempt to send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at mail.linuxgrrls.org http://mail.linuxgrrls.org/mailman/listinfo/rxtx From ricardo.trindade at emation.pt Mon Apr 4 09:17:23 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Mon, 04 Apr 2005 16:17:23 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot Message-ID: <42515A83.4050907@emation.pt> Hi, I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most recent stable snapshot), and get the following exception : It looks like rxtx has been compiled with jdk 1.5. If this was indeed the case, I think there is a compilation flag that generates code that runs on older jdks. java.lang.UnsupportedClassVersionError: gnu/io/UnsupportedCommOperationException (Unsupported major.minor version 49.0) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at java.net.URLClassLoader.defineClass(URLClassLoader.java:251) at java.net.URLClassLoader.access$100(URLClassLoader.java:55) at java.net.URLClassLoader$1.run(URLClassLoader.java:194) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:187) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:141) I'm trying to run it with 1.4. thanks Ricardo From taj at www.linux.org.uk Tue Apr 5 00:48:12 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 07:48:12 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42515A83.4050907@emation.pt> References: <42515A83.4050907@emation.pt> Message-ID: On Mon, 4 Apr 2005, Ricardo Trindade wrote: > Hi, > > I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most > recent stable snapshot), and get the following exception : > > It looks like rxtx has been compiled with jdk 1.5. If this was > indeed the case, I think there is a compilation flag that generates code > that runs on older jdks. > > java.lang.UnsupportedClassVersionError: > gnu/io/UnsupportedCommOperationException (Unsupported major.minor > version 49.0) [snip] Thanks Ricardo I recompiled the jar with javac -source 1.3 -target 1.3. That should cover most of the JRE's in use today. I also compiled the rxtx 2.0 x86_64 native library which appeared to be missing. I tried looking for flags to pass gcc 4.0 to make the native libraries more backwards compatible but only found options for C++ which is not used in rxtx. I've got a list of other bugs that I'll be going through in the next few weeks but for now I just left them with the same CVS filename - no code changes. ftp://ftp.qbang.org/pub/rxtx/rxtx-2.0-CVS-20050120-bins.tar.gz ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-CVS-20050120-bins.tar.gz -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Tue Apr 5 02:24:33 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 05 Apr 2005 09:24:33 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: References: <42515A83.4050907@emation.pt> Message-ID: <42524B41.3040300@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050405/5919abbb/attachment-0068.html From taj at www.linux.org.uk Tue Apr 5 03:00:29 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 10:00:29 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42524B41.3040300@emation.pt> References: <42515A83.4050907@emation.pt> <42524B41.3040300@emation.pt> Message-ID: On Tue, 5 Apr 2005, Ricardo Trindade wrote: > Will you anounce to the list when a new release is available ? > There will be several incremental releases announced here. Once those are done, we will release 2.1.7 and 2.0.7. -- Trent Jarvi taj at www.linux.org.uk From no_spam at somewhere.com Tue Apr 5 11:55:37 2005 From: no_spam at somewhere.com (no_spam@somewhere.com) Date: Tue, 5 Apr 2005 13:55:37 -0400 Subject: [Rxtx] Closing a port from an event listener results in a deadlock Message-ID: <20050405175537.GA21747@rcog.homelinux.net> On the message I sent on March 14, does anyone had the chance to try the modification? Or was it already fixed? (I haven't searched the archive extensively) Or maybe my message got catched by some spam filters? (it made it to the list archive though) Anyway, I would appreciate some feedback (through the list) Thanks From taj at www.linux.org.uk Tue Apr 5 14:42:28 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 21:42:28 +0100 (BST) Subject: [Rxtx] Closing a port from an event listener results in a deadlock In-Reply-To: <20050405175537.GA21747@rcog.homelinux.net> References: <20050405175537.GA21747@rcog.homelinux.net> Message-ID: On Tue, 5 Apr 2005 no_spam at somewhere.com wrote: > On the message I sent on March 14, does anyone had the chance to try the > modification? > > Or was it already fixed? (I haven't searched the archive extensively) > > Or maybe my message got catched by some spam filters? (it made it to the list > archive though) > > Anyway, I would appreciate some feedback (through the list) > The patch is here http://marc.theaimsgroup.com/?l=rxtx&m=111084488820288&w=2 I have applied this patch to a local copy but will not be doing formal testing for a couple weeks. I do not try to close ports from inside the eventListenter usually so I encourage any feedback also. If there are no problems reported, I expect this will go into rxtx 2.1-7. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Wed Apr 6 08:33:42 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Wed, 06 Apr 2005 15:33:42 +0100 Subject: [Rxtx] getting RXTX version Message-ID: <4253F346.50102@emation.pt> Hi, I want to make sure my deployments have the same version of RXTX jar and native lib. I know the version of the jar can be obtained in the Version class, but how can I obtain the native version ? I know RXTX prints to the console a warning if the version is different. Is there a way to programatically know is this is the case ? I would like to log that to our app's log thanks Ricardo From taj at www.linux.org.uk Wed Apr 6 15:10:20 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 6 Apr 2005 22:10:20 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4253F346.50102@emation.pt> References: <4253F346.50102@emation.pt> Message-ID: On Wed, 6 Apr 2005, Ricardo Trindade wrote: > Hi, > > I want to make sure my deployments have the same version of RXTX jar > and native lib. > > I know the version of the jar can be obtained in the Version class, > but how can I obtain the native version ? > > I know RXTX prints to the console a warning if the version is > different. Is there a way to programatically know is this is the case ? > > I would like to log that to our app's log > There isn't a suggested way of doing that right now. We could move things around and have a static String RXTXVersion.getNativeVersion() in future releases. Is this what you expected? This is not documented in commapi at all. I just tossed that in to catch conflicts while developing. It would be nice to have access in GUI applications though. It may be possible to access RXTXCommDriver.LibVersion right now. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Thu Apr 7 02:51:00 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 09:51:00 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> Message-ID: <4254F474.7020905@emation.pt> >There isn't a suggested way of doing that right now. We could move things >around and have a static String RXTXVersion.getNativeVersion() in future >releases. Is this what you expected? > > Yes, that would be perfect. >This is not documented in commapi at all. I just tossed that in to catch >conflicts while developing. It would be nice to have access in GUI >applications though. > >It may be possible to access RXTXCommDriver.LibVersion right now. > > > I tried, and I don't think it's possible. From taj at www.linux.org.uk Thu Apr 7 03:32:04 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 7 Apr 2005 10:32:04 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4254F474.7020905@emation.pt> References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: On Thu, 7 Apr 2005, Ricardo Trindade wrote: > > >There isn't a suggested way of doing that right now. We could move things > >around and have a static String RXTXVersion.getNativeVersion() in future > >releases. Is this what you expected? > > > > > > Yes, that would be perfect. > The attached should do what you want. You will still need to catch an exception for older versions... -- Trent Jarvi taj at www.linux.org.uk -------------- next part -------------- ? public_version.patch Index: RXTXCommDriver.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXCommDriver.java,v retrieving revision 1.16.2.51 diff -u -r1.16.2.51 RXTXCommDriver.java --- RXTXCommDriver.java 12 Oct 2004 09:13:30 -0000 1.16.2.51 +++ RXTXCommDriver.java 7 Apr 2005 09:29:04 -0000 @@ -54,7 +54,7 @@ the Library. */ String JarVersion = RXTXVersion.getVersion(); - String LibVersion = nativeGetVersion(); + String LibVersion = RXTXVersion.nativeGetVersion(); if ( devel ) { System.out.println("Devel Library"); @@ -76,7 +76,6 @@ /** Get the Serial port prefixes for the running OS */ private String deviceDirectory; private String osName; - private static native String nativeGetVersion(); private native boolean registerKnownPorts(int PortType); private native boolean isPortPrefixValid(String dev); private native boolean testRead(String dev, int type); Index: RXTXVersion.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXVersion.java,v retrieving revision 1.2.2.31 diff -u -r1.2.2.31 RXTXVersion.java --- RXTXVersion.java 16 Oct 2004 16:20:35 -0000 1.2.2.31 +++ RXTXVersion.java 7 Apr 2005 09:29:04 -0000 @@ -36,6 +36,7 @@ private static String Version; static { + System.loadLibrary( "rxtxSerial" ); Version = "RXTX-2.1-7pre20"; } /** @@ -47,4 +48,5 @@ { return(Version); } + public static native String nativeGetVersion(); } Index: SerialImp.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v retrieving revision 1.46.2.181 diff -u -r1.46.2.181 SerialImp.c --- SerialImp.c 17 Oct 2004 09:48:56 -0000 1.46.2.181 +++ SerialImp.c 7 Apr 2005 09:29:07 -0000 @@ -116,6 +116,7 @@ * It will eventually be removed. * */ #define RXTXPort(foo) Java_gnu_io_RXTXPort_ ## foo +#define RXTXVersion(foo) Java_gnu_io_RXTXVersion_ ## foo #define RXTXCommDriver(foo) Java_gnu_io_RXTXCommDriver_ ## foo #if defined(__sun__) || defined(__hpux__) @@ -4001,7 +4002,7 @@ } /*---------------------------------------------------------- -RXTXCommDriver.nativeGetVersion +RXTXVersion.nativeGetVersion accept: none perform: return the current version @@ -4010,9 +4011,10 @@ comments: This is used to avoid mixing versions of the .jar and native library. First introduced in rxtx-1.5-9 + Moved from RXTXCommDriver to RXTXVersion in rxtx-2.1-7 ----------------------------------------------------------*/ -JNIEXPORT jstring JNICALL RXTXCommDriver(nativeGetVersion) (JNIEnv *env, +JNIEXPORT jstring JNICALL RXTXVersion(nativeGetVersion) (JNIEnv *env, jclass jclazz ) { return (*env)->NewStringUTF( env, "RXTX-2.1-7pre20" ); From ricardo.trindade at emation.pt Thu Apr 7 03:45:58 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 10:45:58 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: <42550156.2040908@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050407/05212451/attachment-0068.html From thomas.shulok at lmco.com Thu Apr 7 17:43:11 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Thu, 07 Apr 2005 19:43:11 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi There, I'm attempting to talk RS232 between an embedded Linux box and a Windows box. Everything connects up fine, and I can send and receive a simple sequence of bytes with no problems. However, if around 5 seconds goes by without me sending something, I get the following when I attempt to send. java.io.IOException: Input/output error in writeArray Stack trace: java/lang/Throwable.()V java/lang/Throwable.(Ljava/lang/String;)V java/io/IOException.(Ljava/lang/String;)V gnu/io/RXTXPort.writeArray([BIIZ)V gnu/io/RXTXPort$SerialOutputStream.write([B)V SerialTest.main([Ljava/lang/String;)V If there interval is shorter (say 2 seconds between sends), I have no problems. On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and librxtxSerial-2.0.7pre2.so. Any ideas? Thanks, Thom -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5b23dcf/attachment-0068.html From taj at www.linux.org.uk Thu Apr 7 19:22:36 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:22:36 +0100 (BST) Subject: [Rxtx] Input/output error in writeArray In-Reply-To: References: Message-ID: On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a Windows > box. Everything connects up fine, and I can send and receive a simple > sequence of bytes with no problems. However, if around 5 seconds goes > by without me sending something, I get the following when I attempt to > send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Apr 7 19:24:59 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:24:59 +0100 (BST) Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) Message-ID: hmm. This would not work from applets would it? -- Trent Jarvi taj at www.linux.org.uk ---------- Forwarded message ---------- Date: Thu, 07 Apr 2005 16:05:53 -0400 From: Chris Gaffney To: taj at www.linux.org.uk Subject: RXTX Libraries on Classpath fix Hi, I submitted a patch for RXTX a few weeks ago to allow for loading the native libraries from the classpath. Since sending it to you I found it wasn't working on windows. I've fixed the problem and created a new patch that should replace the older one. The actual change is a one line from a String.equals() to a String.startsWith(). Thanks for a great piece of software, -Chris Gaffney Grand Valley State University -------------- next part -------------- A non-text attachment was scrubbed... Name: libraries_on_classpath_fixed.patch Type: text/x-patch Size: 5617 bytes Desc: Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5d423b8/libraries_on_classpath_fixed-0068.bin From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From thomas.shulok at lmco.com Fri Apr 8 10:38:55 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Fri, 08 Apr 2005 12:38:55 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi Trent, Thanks for the prompt response. Before diving deeper, I was wondering if there is a timeout parameter somewhere in the stack that I have not set properly. Given the nature of the failure (only fails if the line has been idle for a few seconds), it feels like some kind of timeout issue... Thanks again, Thom -----Original Message----- From: rxtx-bounces at mail.linuxgrrls.org [mailto:rxtx-bounces at mail.linuxgrrls.org] On Behalf Of Trent Jarvi Sent: Thursday, April 07, 2005 6:23 PM To: Java RXTX discussion Subject: Re: [Rxtx] Input/output error in writeArray On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a > Windows box. Everything connects up fine, and I can send and receive > a simple sequence of bytes with no problems. However, if around 5 > seconds goes by without me sending something, I get the following when > I attempt to send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at mail.linuxgrrls.org http://mail.linuxgrrls.org/mailman/listinfo/rxtx From ricardo.trindade at emation.pt Mon Apr 4 09:17:23 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Mon, 04 Apr 2005 16:17:23 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot Message-ID: <42515A83.4050907@emation.pt> Hi, I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most recent stable snapshot), and get the following exception : It looks like rxtx has been compiled with jdk 1.5. If this was indeed the case, I think there is a compilation flag that generates code that runs on older jdks. java.lang.UnsupportedClassVersionError: gnu/io/UnsupportedCommOperationException (Unsupported major.minor version 49.0) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at java.net.URLClassLoader.defineClass(URLClassLoader.java:251) at java.net.URLClassLoader.access$100(URLClassLoader.java:55) at java.net.URLClassLoader$1.run(URLClassLoader.java:194) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:187) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:141) I'm trying to run it with 1.4. thanks Ricardo From taj at www.linux.org.uk Tue Apr 5 00:48:12 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 07:48:12 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42515A83.4050907@emation.pt> References: <42515A83.4050907@emation.pt> Message-ID: On Mon, 4 Apr 2005, Ricardo Trindade wrote: > Hi, > > I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most > recent stable snapshot), and get the following exception : > > It looks like rxtx has been compiled with jdk 1.5. If this was > indeed the case, I think there is a compilation flag that generates code > that runs on older jdks. > > java.lang.UnsupportedClassVersionError: > gnu/io/UnsupportedCommOperationException (Unsupported major.minor > version 49.0) [snip] Thanks Ricardo I recompiled the jar with javac -source 1.3 -target 1.3. That should cover most of the JRE's in use today. I also compiled the rxtx 2.0 x86_64 native library which appeared to be missing. I tried looking for flags to pass gcc 4.0 to make the native libraries more backwards compatible but only found options for C++ which is not used in rxtx. I've got a list of other bugs that I'll be going through in the next few weeks but for now I just left them with the same CVS filename - no code changes. ftp://ftp.qbang.org/pub/rxtx/rxtx-2.0-CVS-20050120-bins.tar.gz ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-CVS-20050120-bins.tar.gz -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Tue Apr 5 02:24:33 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 05 Apr 2005 09:24:33 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: References: <42515A83.4050907@emation.pt> Message-ID: <42524B41.3040300@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050405/5919abbb/attachment-0069.html From taj at www.linux.org.uk Tue Apr 5 03:00:29 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 10:00:29 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42524B41.3040300@emation.pt> References: <42515A83.4050907@emation.pt> <42524B41.3040300@emation.pt> Message-ID: On Tue, 5 Apr 2005, Ricardo Trindade wrote: > Will you anounce to the list when a new release is available ? > There will be several incremental releases announced here. Once those are done, we will release 2.1.7 and 2.0.7. -- Trent Jarvi taj at www.linux.org.uk From no_spam at somewhere.com Tue Apr 5 11:55:37 2005 From: no_spam at somewhere.com (no_spam@somewhere.com) Date: Tue, 5 Apr 2005 13:55:37 -0400 Subject: [Rxtx] Closing a port from an event listener results in a deadlock Message-ID: <20050405175537.GA21747@rcog.homelinux.net> On the message I sent on March 14, does anyone had the chance to try the modification? Or was it already fixed? (I haven't searched the archive extensively) Or maybe my message got catched by some spam filters? (it made it to the list archive though) Anyway, I would appreciate some feedback (through the list) Thanks From taj at www.linux.org.uk Tue Apr 5 14:42:28 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 21:42:28 +0100 (BST) Subject: [Rxtx] Closing a port from an event listener results in a deadlock In-Reply-To: <20050405175537.GA21747@rcog.homelinux.net> References: <20050405175537.GA21747@rcog.homelinux.net> Message-ID: On Tue, 5 Apr 2005 no_spam at somewhere.com wrote: > On the message I sent on March 14, does anyone had the chance to try the > modification? > > Or was it already fixed? (I haven't searched the archive extensively) > > Or maybe my message got catched by some spam filters? (it made it to the list > archive though) > > Anyway, I would appreciate some feedback (through the list) > The patch is here http://marc.theaimsgroup.com/?l=rxtx&m=111084488820288&w=2 I have applied this patch to a local copy but will not be doing formal testing for a couple weeks. I do not try to close ports from inside the eventListenter usually so I encourage any feedback also. If there are no problems reported, I expect this will go into rxtx 2.1-7. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Wed Apr 6 08:33:42 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Wed, 06 Apr 2005 15:33:42 +0100 Subject: [Rxtx] getting RXTX version Message-ID: <4253F346.50102@emation.pt> Hi, I want to make sure my deployments have the same version of RXTX jar and native lib. I know the version of the jar can be obtained in the Version class, but how can I obtain the native version ? I know RXTX prints to the console a warning if the version is different. Is there a way to programatically know is this is the case ? I would like to log that to our app's log thanks Ricardo From taj at www.linux.org.uk Wed Apr 6 15:10:20 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 6 Apr 2005 22:10:20 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4253F346.50102@emation.pt> References: <4253F346.50102@emation.pt> Message-ID: On Wed, 6 Apr 2005, Ricardo Trindade wrote: > Hi, > > I want to make sure my deployments have the same version of RXTX jar > and native lib. > > I know the version of the jar can be obtained in the Version class, > but how can I obtain the native version ? > > I know RXTX prints to the console a warning if the version is > different. Is there a way to programatically know is this is the case ? > > I would like to log that to our app's log > There isn't a suggested way of doing that right now. We could move things around and have a static String RXTXVersion.getNativeVersion() in future releases. Is this what you expected? This is not documented in commapi at all. I just tossed that in to catch conflicts while developing. It would be nice to have access in GUI applications though. It may be possible to access RXTXCommDriver.LibVersion right now. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Thu Apr 7 02:51:00 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 09:51:00 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> Message-ID: <4254F474.7020905@emation.pt> >There isn't a suggested way of doing that right now. We could move things >around and have a static String RXTXVersion.getNativeVersion() in future >releases. Is this what you expected? > > Yes, that would be perfect. >This is not documented in commapi at all. I just tossed that in to catch >conflicts while developing. It would be nice to have access in GUI >applications though. > >It may be possible to access RXTXCommDriver.LibVersion right now. > > > I tried, and I don't think it's possible. From taj at www.linux.org.uk Thu Apr 7 03:32:04 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 7 Apr 2005 10:32:04 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4254F474.7020905@emation.pt> References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: On Thu, 7 Apr 2005, Ricardo Trindade wrote: > > >There isn't a suggested way of doing that right now. We could move things > >around and have a static String RXTXVersion.getNativeVersion() in future > >releases. Is this what you expected? > > > > > > Yes, that would be perfect. > The attached should do what you want. You will still need to catch an exception for older versions... -- Trent Jarvi taj at www.linux.org.uk -------------- next part -------------- ? public_version.patch Index: RXTXCommDriver.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXCommDriver.java,v retrieving revision 1.16.2.51 diff -u -r1.16.2.51 RXTXCommDriver.java --- RXTXCommDriver.java 12 Oct 2004 09:13:30 -0000 1.16.2.51 +++ RXTXCommDriver.java 7 Apr 2005 09:29:04 -0000 @@ -54,7 +54,7 @@ the Library. */ String JarVersion = RXTXVersion.getVersion(); - String LibVersion = nativeGetVersion(); + String LibVersion = RXTXVersion.nativeGetVersion(); if ( devel ) { System.out.println("Devel Library"); @@ -76,7 +76,6 @@ /** Get the Serial port prefixes for the running OS */ private String deviceDirectory; private String osName; - private static native String nativeGetVersion(); private native boolean registerKnownPorts(int PortType); private native boolean isPortPrefixValid(String dev); private native boolean testRead(String dev, int type); Index: RXTXVersion.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXVersion.java,v retrieving revision 1.2.2.31 diff -u -r1.2.2.31 RXTXVersion.java --- RXTXVersion.java 16 Oct 2004 16:20:35 -0000 1.2.2.31 +++ RXTXVersion.java 7 Apr 2005 09:29:04 -0000 @@ -36,6 +36,7 @@ private static String Version; static { + System.loadLibrary( "rxtxSerial" ); Version = "RXTX-2.1-7pre20"; } /** @@ -47,4 +48,5 @@ { return(Version); } + public static native String nativeGetVersion(); } Index: SerialImp.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v retrieving revision 1.46.2.181 diff -u -r1.46.2.181 SerialImp.c --- SerialImp.c 17 Oct 2004 09:48:56 -0000 1.46.2.181 +++ SerialImp.c 7 Apr 2005 09:29:07 -0000 @@ -116,6 +116,7 @@ * It will eventually be removed. * */ #define RXTXPort(foo) Java_gnu_io_RXTXPort_ ## foo +#define RXTXVersion(foo) Java_gnu_io_RXTXVersion_ ## foo #define RXTXCommDriver(foo) Java_gnu_io_RXTXCommDriver_ ## foo #if defined(__sun__) || defined(__hpux__) @@ -4001,7 +4002,7 @@ } /*---------------------------------------------------------- -RXTXCommDriver.nativeGetVersion +RXTXVersion.nativeGetVersion accept: none perform: return the current version @@ -4010,9 +4011,10 @@ comments: This is used to avoid mixing versions of the .jar and native library. First introduced in rxtx-1.5-9 + Moved from RXTXCommDriver to RXTXVersion in rxtx-2.1-7 ----------------------------------------------------------*/ -JNIEXPORT jstring JNICALL RXTXCommDriver(nativeGetVersion) (JNIEnv *env, +JNIEXPORT jstring JNICALL RXTXVersion(nativeGetVersion) (JNIEnv *env, jclass jclazz ) { return (*env)->NewStringUTF( env, "RXTX-2.1-7pre20" ); From ricardo.trindade at emation.pt Thu Apr 7 03:45:58 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 10:45:58 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: <42550156.2040908@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050407/05212451/attachment-0069.html From thomas.shulok at lmco.com Thu Apr 7 17:43:11 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Thu, 07 Apr 2005 19:43:11 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi There, I'm attempting to talk RS232 between an embedded Linux box and a Windows box. Everything connects up fine, and I can send and receive a simple sequence of bytes with no problems. However, if around 5 seconds goes by without me sending something, I get the following when I attempt to send. java.io.IOException: Input/output error in writeArray Stack trace: java/lang/Throwable.()V java/lang/Throwable.(Ljava/lang/String;)V java/io/IOException.(Ljava/lang/String;)V gnu/io/RXTXPort.writeArray([BIIZ)V gnu/io/RXTXPort$SerialOutputStream.write([B)V SerialTest.main([Ljava/lang/String;)V If there interval is shorter (say 2 seconds between sends), I have no problems. On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and librxtxSerial-2.0.7pre2.so. Any ideas? Thanks, Thom -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5b23dcf/attachment-0069.html From taj at www.linux.org.uk Thu Apr 7 19:22:36 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:22:36 +0100 (BST) Subject: [Rxtx] Input/output error in writeArray In-Reply-To: References: Message-ID: On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a Windows > box. Everything connects up fine, and I can send and receive a simple > sequence of bytes with no problems. However, if around 5 seconds goes > by without me sending something, I get the following when I attempt to > send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Apr 7 19:24:59 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:24:59 +0100 (BST) Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) Message-ID: hmm. This would not work from applets would it? -- Trent Jarvi taj at www.linux.org.uk ---------- Forwarded message ---------- Date: Thu, 07 Apr 2005 16:05:53 -0400 From: Chris Gaffney To: taj at www.linux.org.uk Subject: RXTX Libraries on Classpath fix Hi, I submitted a patch for RXTX a few weeks ago to allow for loading the native libraries from the classpath. Since sending it to you I found it wasn't working on windows. I've fixed the problem and created a new patch that should replace the older one. The actual change is a one line from a String.equals() to a String.startsWith(). Thanks for a great piece of software, -Chris Gaffney Grand Valley State University -------------- next part -------------- A non-text attachment was scrubbed... Name: libraries_on_classpath_fixed.patch Type: text/x-patch Size: 5617 bytes Desc: Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5d423b8/libraries_on_classpath_fixed-0069.bin From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From thomas.shulok at lmco.com Fri Apr 8 10:38:55 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Fri, 08 Apr 2005 12:38:55 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi Trent, Thanks for the prompt response. Before diving deeper, I was wondering if there is a timeout parameter somewhere in the stack that I have not set properly. Given the nature of the failure (only fails if the line has been idle for a few seconds), it feels like some kind of timeout issue... Thanks again, Thom -----Original Message----- From: rxtx-bounces at mail.linuxgrrls.org [mailto:rxtx-bounces at mail.linuxgrrls.org] On Behalf Of Trent Jarvi Sent: Thursday, April 07, 2005 6:23 PM To: Java RXTX discussion Subject: Re: [Rxtx] Input/output error in writeArray On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a > Windows box. Everything connects up fine, and I can send and receive > a simple sequence of bytes with no problems. However, if around 5 > seconds goes by without me sending something, I get the following when > I attempt to send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at mail.linuxgrrls.org http://mail.linuxgrrls.org/mailman/listinfo/rxtx From ricardo.trindade at emation.pt Mon Apr 4 09:17:23 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Mon, 04 Apr 2005 16:17:23 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot Message-ID: <42515A83.4050907@emation.pt> Hi, I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most recent stable snapshot), and get the following exception : It looks like rxtx has been compiled with jdk 1.5. If this was indeed the case, I think there is a compilation flag that generates code that runs on older jdks. java.lang.UnsupportedClassVersionError: gnu/io/UnsupportedCommOperationException (Unsupported major.minor version 49.0) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at java.net.URLClassLoader.defineClass(URLClassLoader.java:251) at java.net.URLClassLoader.access$100(URLClassLoader.java:55) at java.net.URLClassLoader$1.run(URLClassLoader.java:194) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:187) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:141) I'm trying to run it with 1.4. thanks Ricardo From taj at www.linux.org.uk Tue Apr 5 00:48:12 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 07:48:12 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42515A83.4050907@emation.pt> References: <42515A83.4050907@emation.pt> Message-ID: On Mon, 4 Apr 2005, Ricardo Trindade wrote: > Hi, > > I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most > recent stable snapshot), and get the following exception : > > It looks like rxtx has been compiled with jdk 1.5. If this was > indeed the case, I think there is a compilation flag that generates code > that runs on older jdks. > > java.lang.UnsupportedClassVersionError: > gnu/io/UnsupportedCommOperationException (Unsupported major.minor > version 49.0) [snip] Thanks Ricardo I recompiled the jar with javac -source 1.3 -target 1.3. That should cover most of the JRE's in use today. I also compiled the rxtx 2.0 x86_64 native library which appeared to be missing. I tried looking for flags to pass gcc 4.0 to make the native libraries more backwards compatible but only found options for C++ which is not used in rxtx. I've got a list of other bugs that I'll be going through in the next few weeks but for now I just left them with the same CVS filename - no code changes. ftp://ftp.qbang.org/pub/rxtx/rxtx-2.0-CVS-20050120-bins.tar.gz ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-CVS-20050120-bins.tar.gz -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Tue Apr 5 02:24:33 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 05 Apr 2005 09:24:33 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: References: <42515A83.4050907@emation.pt> Message-ID: <42524B41.3040300@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050405/5919abbb/attachment-0070.html From taj at www.linux.org.uk Tue Apr 5 03:00:29 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 10:00:29 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42524B41.3040300@emation.pt> References: <42515A83.4050907@emation.pt> <42524B41.3040300@emation.pt> Message-ID: On Tue, 5 Apr 2005, Ricardo Trindade wrote: > Will you anounce to the list when a new release is available ? > There will be several incremental releases announced here. Once those are done, we will release 2.1.7 and 2.0.7. -- Trent Jarvi taj at www.linux.org.uk From no_spam at somewhere.com Tue Apr 5 11:55:37 2005 From: no_spam at somewhere.com (no_spam@somewhere.com) Date: Tue, 5 Apr 2005 13:55:37 -0400 Subject: [Rxtx] Closing a port from an event listener results in a deadlock Message-ID: <20050405175537.GA21747@rcog.homelinux.net> On the message I sent on March 14, does anyone had the chance to try the modification? Or was it already fixed? (I haven't searched the archive extensively) Or maybe my message got catched by some spam filters? (it made it to the list archive though) Anyway, I would appreciate some feedback (through the list) Thanks From taj at www.linux.org.uk Tue Apr 5 14:42:28 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 21:42:28 +0100 (BST) Subject: [Rxtx] Closing a port from an event listener results in a deadlock In-Reply-To: <20050405175537.GA21747@rcog.homelinux.net> References: <20050405175537.GA21747@rcog.homelinux.net> Message-ID: On Tue, 5 Apr 2005 no_spam at somewhere.com wrote: > On the message I sent on March 14, does anyone had the chance to try the > modification? > > Or was it already fixed? (I haven't searched the archive extensively) > > Or maybe my message got catched by some spam filters? (it made it to the list > archive though) > > Anyway, I would appreciate some feedback (through the list) > The patch is here http://marc.theaimsgroup.com/?l=rxtx&m=111084488820288&w=2 I have applied this patch to a local copy but will not be doing formal testing for a couple weeks. I do not try to close ports from inside the eventListenter usually so I encourage any feedback also. If there are no problems reported, I expect this will go into rxtx 2.1-7. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Wed Apr 6 08:33:42 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Wed, 06 Apr 2005 15:33:42 +0100 Subject: [Rxtx] getting RXTX version Message-ID: <4253F346.50102@emation.pt> Hi, I want to make sure my deployments have the same version of RXTX jar and native lib. I know the version of the jar can be obtained in the Version class, but how can I obtain the native version ? I know RXTX prints to the console a warning if the version is different. Is there a way to programatically know is this is the case ? I would like to log that to our app's log thanks Ricardo From taj at www.linux.org.uk Wed Apr 6 15:10:20 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 6 Apr 2005 22:10:20 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4253F346.50102@emation.pt> References: <4253F346.50102@emation.pt> Message-ID: On Wed, 6 Apr 2005, Ricardo Trindade wrote: > Hi, > > I want to make sure my deployments have the same version of RXTX jar > and native lib. > > I know the version of the jar can be obtained in the Version class, > but how can I obtain the native version ? > > I know RXTX prints to the console a warning if the version is > different. Is there a way to programatically know is this is the case ? > > I would like to log that to our app's log > There isn't a suggested way of doing that right now. We could move things around and have a static String RXTXVersion.getNativeVersion() in future releases. Is this what you expected? This is not documented in commapi at all. I just tossed that in to catch conflicts while developing. It would be nice to have access in GUI applications though. It may be possible to access RXTXCommDriver.LibVersion right now. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Thu Apr 7 02:51:00 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 09:51:00 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> Message-ID: <4254F474.7020905@emation.pt> >There isn't a suggested way of doing that right now. We could move things >around and have a static String RXTXVersion.getNativeVersion() in future >releases. Is this what you expected? > > Yes, that would be perfect. >This is not documented in commapi at all. I just tossed that in to catch >conflicts while developing. It would be nice to have access in GUI >applications though. > >It may be possible to access RXTXCommDriver.LibVersion right now. > > > I tried, and I don't think it's possible. From taj at www.linux.org.uk Thu Apr 7 03:32:04 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 7 Apr 2005 10:32:04 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4254F474.7020905@emation.pt> References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: On Thu, 7 Apr 2005, Ricardo Trindade wrote: > > >There isn't a suggested way of doing that right now. We could move things > >around and have a static String RXTXVersion.getNativeVersion() in future > >releases. Is this what you expected? > > > > > > Yes, that would be perfect. > The attached should do what you want. You will still need to catch an exception for older versions... -- Trent Jarvi taj at www.linux.org.uk -------------- next part -------------- ? public_version.patch Index: RXTXCommDriver.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXCommDriver.java,v retrieving revision 1.16.2.51 diff -u -r1.16.2.51 RXTXCommDriver.java --- RXTXCommDriver.java 12 Oct 2004 09:13:30 -0000 1.16.2.51 +++ RXTXCommDriver.java 7 Apr 2005 09:29:04 -0000 @@ -54,7 +54,7 @@ the Library. */ String JarVersion = RXTXVersion.getVersion(); - String LibVersion = nativeGetVersion(); + String LibVersion = RXTXVersion.nativeGetVersion(); if ( devel ) { System.out.println("Devel Library"); @@ -76,7 +76,6 @@ /** Get the Serial port prefixes for the running OS */ private String deviceDirectory; private String osName; - private static native String nativeGetVersion(); private native boolean registerKnownPorts(int PortType); private native boolean isPortPrefixValid(String dev); private native boolean testRead(String dev, int type); Index: RXTXVersion.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXVersion.java,v retrieving revision 1.2.2.31 diff -u -r1.2.2.31 RXTXVersion.java --- RXTXVersion.java 16 Oct 2004 16:20:35 -0000 1.2.2.31 +++ RXTXVersion.java 7 Apr 2005 09:29:04 -0000 @@ -36,6 +36,7 @@ private static String Version; static { + System.loadLibrary( "rxtxSerial" ); Version = "RXTX-2.1-7pre20"; } /** @@ -47,4 +48,5 @@ { return(Version); } + public static native String nativeGetVersion(); } Index: SerialImp.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v retrieving revision 1.46.2.181 diff -u -r1.46.2.181 SerialImp.c --- SerialImp.c 17 Oct 2004 09:48:56 -0000 1.46.2.181 +++ SerialImp.c 7 Apr 2005 09:29:07 -0000 @@ -116,6 +116,7 @@ * It will eventually be removed. * */ #define RXTXPort(foo) Java_gnu_io_RXTXPort_ ## foo +#define RXTXVersion(foo) Java_gnu_io_RXTXVersion_ ## foo #define RXTXCommDriver(foo) Java_gnu_io_RXTXCommDriver_ ## foo #if defined(__sun__) || defined(__hpux__) @@ -4001,7 +4002,7 @@ } /*---------------------------------------------------------- -RXTXCommDriver.nativeGetVersion +RXTXVersion.nativeGetVersion accept: none perform: return the current version @@ -4010,9 +4011,10 @@ comments: This is used to avoid mixing versions of the .jar and native library. First introduced in rxtx-1.5-9 + Moved from RXTXCommDriver to RXTXVersion in rxtx-2.1-7 ----------------------------------------------------------*/ -JNIEXPORT jstring JNICALL RXTXCommDriver(nativeGetVersion) (JNIEnv *env, +JNIEXPORT jstring JNICALL RXTXVersion(nativeGetVersion) (JNIEnv *env, jclass jclazz ) { return (*env)->NewStringUTF( env, "RXTX-2.1-7pre20" ); From ricardo.trindade at emation.pt Thu Apr 7 03:45:58 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 10:45:58 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: <42550156.2040908@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050407/05212451/attachment-0070.html From thomas.shulok at lmco.com Thu Apr 7 17:43:11 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Thu, 07 Apr 2005 19:43:11 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi There, I'm attempting to talk RS232 between an embedded Linux box and a Windows box. Everything connects up fine, and I can send and receive a simple sequence of bytes with no problems. However, if around 5 seconds goes by without me sending something, I get the following when I attempt to send. java.io.IOException: Input/output error in writeArray Stack trace: java/lang/Throwable.()V java/lang/Throwable.(Ljava/lang/String;)V java/io/IOException.(Ljava/lang/String;)V gnu/io/RXTXPort.writeArray([BIIZ)V gnu/io/RXTXPort$SerialOutputStream.write([B)V SerialTest.main([Ljava/lang/String;)V If there interval is shorter (say 2 seconds between sends), I have no problems. On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and librxtxSerial-2.0.7pre2.so. Any ideas? Thanks, Thom -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5b23dcf/attachment-0070.html From taj at www.linux.org.uk Thu Apr 7 19:22:36 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:22:36 +0100 (BST) Subject: [Rxtx] Input/output error in writeArray In-Reply-To: References: Message-ID: On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a Windows > box. Everything connects up fine, and I can send and receive a simple > sequence of bytes with no problems. However, if around 5 seconds goes > by without me sending something, I get the following when I attempt to > send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Apr 7 19:24:59 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:24:59 +0100 (BST) Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) Message-ID: hmm. This would not work from applets would it? -- Trent Jarvi taj at www.linux.org.uk ---------- Forwarded message ---------- Date: Thu, 07 Apr 2005 16:05:53 -0400 From: Chris Gaffney To: taj at www.linux.org.uk Subject: RXTX Libraries on Classpath fix Hi, I submitted a patch for RXTX a few weeks ago to allow for loading the native libraries from the classpath. Since sending it to you I found it wasn't working on windows. I've fixed the problem and created a new patch that should replace the older one. The actual change is a one line from a String.equals() to a String.startsWith(). Thanks for a great piece of software, -Chris Gaffney Grand Valley State University -------------- next part -------------- A non-text attachment was scrubbed... Name: libraries_on_classpath_fixed.patch Type: text/x-patch Size: 5617 bytes Desc: Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5d423b8/libraries_on_classpath_fixed-0070.bin From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From thomas.shulok at lmco.com Fri Apr 8 10:38:55 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Fri, 08 Apr 2005 12:38:55 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi Trent, Thanks for the prompt response. Before diving deeper, I was wondering if there is a timeout parameter somewhere in the stack that I have not set properly. Given the nature of the failure (only fails if the line has been idle for a few seconds), it feels like some kind of timeout issue... Thanks again, Thom -----Original Message----- From: rxtx-bounces at mail.linuxgrrls.org [mailto:rxtx-bounces at mail.linuxgrrls.org] On Behalf Of Trent Jarvi Sent: Thursday, April 07, 2005 6:23 PM To: Java RXTX discussion Subject: Re: [Rxtx] Input/output error in writeArray On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a > Windows box. Everything connects up fine, and I can send and receive > a simple sequence of bytes with no problems. However, if around 5 > seconds goes by without me sending something, I get the following when > I attempt to send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at mail.linuxgrrls.org http://mail.linuxgrrls.org/mailman/listinfo/rxtx From ricardo.trindade at emation.pt Mon Apr 4 09:17:23 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Mon, 04 Apr 2005 16:17:23 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot Message-ID: <42515A83.4050907@emation.pt> Hi, I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most recent stable snapshot), and get the following exception : It looks like rxtx has been compiled with jdk 1.5. If this was indeed the case, I think there is a compilation flag that generates code that runs on older jdks. java.lang.UnsupportedClassVersionError: gnu/io/UnsupportedCommOperationException (Unsupported major.minor version 49.0) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at java.net.URLClassLoader.defineClass(URLClassLoader.java:251) at java.net.URLClassLoader.access$100(URLClassLoader.java:55) at java.net.URLClassLoader$1.run(URLClassLoader.java:194) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:187) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:141) I'm trying to run it with 1.4. thanks Ricardo From taj at www.linux.org.uk Tue Apr 5 00:48:12 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 07:48:12 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42515A83.4050907@emation.pt> References: <42515A83.4050907@emation.pt> Message-ID: On Mon, 4 Apr 2005, Ricardo Trindade wrote: > Hi, > > I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most > recent stable snapshot), and get the following exception : > > It looks like rxtx has been compiled with jdk 1.5. If this was > indeed the case, I think there is a compilation flag that generates code > that runs on older jdks. > > java.lang.UnsupportedClassVersionError: > gnu/io/UnsupportedCommOperationException (Unsupported major.minor > version 49.0) [snip] Thanks Ricardo I recompiled the jar with javac -source 1.3 -target 1.3. That should cover most of the JRE's in use today. I also compiled the rxtx 2.0 x86_64 native library which appeared to be missing. I tried looking for flags to pass gcc 4.0 to make the native libraries more backwards compatible but only found options for C++ which is not used in rxtx. I've got a list of other bugs that I'll be going through in the next few weeks but for now I just left them with the same CVS filename - no code changes. ftp://ftp.qbang.org/pub/rxtx/rxtx-2.0-CVS-20050120-bins.tar.gz ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-CVS-20050120-bins.tar.gz -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Tue Apr 5 02:24:33 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 05 Apr 2005 09:24:33 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: References: <42515A83.4050907@emation.pt> Message-ID: <42524B41.3040300@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050405/5919abbb/attachment-0071.html From taj at www.linux.org.uk Tue Apr 5 03:00:29 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 10:00:29 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42524B41.3040300@emation.pt> References: <42515A83.4050907@emation.pt> <42524B41.3040300@emation.pt> Message-ID: On Tue, 5 Apr 2005, Ricardo Trindade wrote: > Will you anounce to the list when a new release is available ? > There will be several incremental releases announced here. Once those are done, we will release 2.1.7 and 2.0.7. -- Trent Jarvi taj at www.linux.org.uk From no_spam at somewhere.com Tue Apr 5 11:55:37 2005 From: no_spam at somewhere.com (no_spam@somewhere.com) Date: Tue, 5 Apr 2005 13:55:37 -0400 Subject: [Rxtx] Closing a port from an event listener results in a deadlock Message-ID: <20050405175537.GA21747@rcog.homelinux.net> On the message I sent on March 14, does anyone had the chance to try the modification? Or was it already fixed? (I haven't searched the archive extensively) Or maybe my message got catched by some spam filters? (it made it to the list archive though) Anyway, I would appreciate some feedback (through the list) Thanks From taj at www.linux.org.uk Tue Apr 5 14:42:28 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 21:42:28 +0100 (BST) Subject: [Rxtx] Closing a port from an event listener results in a deadlock In-Reply-To: <20050405175537.GA21747@rcog.homelinux.net> References: <20050405175537.GA21747@rcog.homelinux.net> Message-ID: On Tue, 5 Apr 2005 no_spam at somewhere.com wrote: > On the message I sent on March 14, does anyone had the chance to try the > modification? > > Or was it already fixed? (I haven't searched the archive extensively) > > Or maybe my message got catched by some spam filters? (it made it to the list > archive though) > > Anyway, I would appreciate some feedback (through the list) > The patch is here http://marc.theaimsgroup.com/?l=rxtx&m=111084488820288&w=2 I have applied this patch to a local copy but will not be doing formal testing for a couple weeks. I do not try to close ports from inside the eventListenter usually so I encourage any feedback also. If there are no problems reported, I expect this will go into rxtx 2.1-7. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Wed Apr 6 08:33:42 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Wed, 06 Apr 2005 15:33:42 +0100 Subject: [Rxtx] getting RXTX version Message-ID: <4253F346.50102@emation.pt> Hi, I want to make sure my deployments have the same version of RXTX jar and native lib. I know the version of the jar can be obtained in the Version class, but how can I obtain the native version ? I know RXTX prints to the console a warning if the version is different. Is there a way to programatically know is this is the case ? I would like to log that to our app's log thanks Ricardo From taj at www.linux.org.uk Wed Apr 6 15:10:20 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 6 Apr 2005 22:10:20 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4253F346.50102@emation.pt> References: <4253F346.50102@emation.pt> Message-ID: On Wed, 6 Apr 2005, Ricardo Trindade wrote: > Hi, > > I want to make sure my deployments have the same version of RXTX jar > and native lib. > > I know the version of the jar can be obtained in the Version class, > but how can I obtain the native version ? > > I know RXTX prints to the console a warning if the version is > different. Is there a way to programatically know is this is the case ? > > I would like to log that to our app's log > There isn't a suggested way of doing that right now. We could move things around and have a static String RXTXVersion.getNativeVersion() in future releases. Is this what you expected? This is not documented in commapi at all. I just tossed that in to catch conflicts while developing. It would be nice to have access in GUI applications though. It may be possible to access RXTXCommDriver.LibVersion right now. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Thu Apr 7 02:51:00 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 09:51:00 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> Message-ID: <4254F474.7020905@emation.pt> >There isn't a suggested way of doing that right now. We could move things >around and have a static String RXTXVersion.getNativeVersion() in future >releases. Is this what you expected? > > Yes, that would be perfect. >This is not documented in commapi at all. I just tossed that in to catch >conflicts while developing. It would be nice to have access in GUI >applications though. > >It may be possible to access RXTXCommDriver.LibVersion right now. > > > I tried, and I don't think it's possible. From taj at www.linux.org.uk Thu Apr 7 03:32:04 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 7 Apr 2005 10:32:04 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4254F474.7020905@emation.pt> References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: On Thu, 7 Apr 2005, Ricardo Trindade wrote: > > >There isn't a suggested way of doing that right now. We could move things > >around and have a static String RXTXVersion.getNativeVersion() in future > >releases. Is this what you expected? > > > > > > Yes, that would be perfect. > The attached should do what you want. You will still need to catch an exception for older versions... -- Trent Jarvi taj at www.linux.org.uk -------------- next part -------------- ? public_version.patch Index: RXTXCommDriver.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXCommDriver.java,v retrieving revision 1.16.2.51 diff -u -r1.16.2.51 RXTXCommDriver.java --- RXTXCommDriver.java 12 Oct 2004 09:13:30 -0000 1.16.2.51 +++ RXTXCommDriver.java 7 Apr 2005 09:29:04 -0000 @@ -54,7 +54,7 @@ the Library. */ String JarVersion = RXTXVersion.getVersion(); - String LibVersion = nativeGetVersion(); + String LibVersion = RXTXVersion.nativeGetVersion(); if ( devel ) { System.out.println("Devel Library"); @@ -76,7 +76,6 @@ /** Get the Serial port prefixes for the running OS */ private String deviceDirectory; private String osName; - private static native String nativeGetVersion(); private native boolean registerKnownPorts(int PortType); private native boolean isPortPrefixValid(String dev); private native boolean testRead(String dev, int type); Index: RXTXVersion.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXVersion.java,v retrieving revision 1.2.2.31 diff -u -r1.2.2.31 RXTXVersion.java --- RXTXVersion.java 16 Oct 2004 16:20:35 -0000 1.2.2.31 +++ RXTXVersion.java 7 Apr 2005 09:29:04 -0000 @@ -36,6 +36,7 @@ private static String Version; static { + System.loadLibrary( "rxtxSerial" ); Version = "RXTX-2.1-7pre20"; } /** @@ -47,4 +48,5 @@ { return(Version); } + public static native String nativeGetVersion(); } Index: SerialImp.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v retrieving revision 1.46.2.181 diff -u -r1.46.2.181 SerialImp.c --- SerialImp.c 17 Oct 2004 09:48:56 -0000 1.46.2.181 +++ SerialImp.c 7 Apr 2005 09:29:07 -0000 @@ -116,6 +116,7 @@ * It will eventually be removed. * */ #define RXTXPort(foo) Java_gnu_io_RXTXPort_ ## foo +#define RXTXVersion(foo) Java_gnu_io_RXTXVersion_ ## foo #define RXTXCommDriver(foo) Java_gnu_io_RXTXCommDriver_ ## foo #if defined(__sun__) || defined(__hpux__) @@ -4001,7 +4002,7 @@ } /*---------------------------------------------------------- -RXTXCommDriver.nativeGetVersion +RXTXVersion.nativeGetVersion accept: none perform: return the current version @@ -4010,9 +4011,10 @@ comments: This is used to avoid mixing versions of the .jar and native library. First introduced in rxtx-1.5-9 + Moved from RXTXCommDriver to RXTXVersion in rxtx-2.1-7 ----------------------------------------------------------*/ -JNIEXPORT jstring JNICALL RXTXCommDriver(nativeGetVersion) (JNIEnv *env, +JNIEXPORT jstring JNICALL RXTXVersion(nativeGetVersion) (JNIEnv *env, jclass jclazz ) { return (*env)->NewStringUTF( env, "RXTX-2.1-7pre20" ); From ricardo.trindade at emation.pt Thu Apr 7 03:45:58 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 10:45:58 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: <42550156.2040908@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050407/05212451/attachment-0071.html From thomas.shulok at lmco.com Thu Apr 7 17:43:11 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Thu, 07 Apr 2005 19:43:11 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi There, I'm attempting to talk RS232 between an embedded Linux box and a Windows box. Everything connects up fine, and I can send and receive a simple sequence of bytes with no problems. However, if around 5 seconds goes by without me sending something, I get the following when I attempt to send. java.io.IOException: Input/output error in writeArray Stack trace: java/lang/Throwable.()V java/lang/Throwable.(Ljava/lang/String;)V java/io/IOException.(Ljava/lang/String;)V gnu/io/RXTXPort.writeArray([BIIZ)V gnu/io/RXTXPort$SerialOutputStream.write([B)V SerialTest.main([Ljava/lang/String;)V If there interval is shorter (say 2 seconds between sends), I have no problems. On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and librxtxSerial-2.0.7pre2.so. Any ideas? Thanks, Thom -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5b23dcf/attachment-0071.html From taj at www.linux.org.uk Thu Apr 7 19:22:36 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:22:36 +0100 (BST) Subject: [Rxtx] Input/output error in writeArray In-Reply-To: References: Message-ID: On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a Windows > box. Everything connects up fine, and I can send and receive a simple > sequence of bytes with no problems. However, if around 5 seconds goes > by without me sending something, I get the following when I attempt to > send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Apr 7 19:24:59 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:24:59 +0100 (BST) Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) Message-ID: hmm. This would not work from applets would it? -- Trent Jarvi taj at www.linux.org.uk ---------- Forwarded message ---------- Date: Thu, 07 Apr 2005 16:05:53 -0400 From: Chris Gaffney To: taj at www.linux.org.uk Subject: RXTX Libraries on Classpath fix Hi, I submitted a patch for RXTX a few weeks ago to allow for loading the native libraries from the classpath. Since sending it to you I found it wasn't working on windows. I've fixed the problem and created a new patch that should replace the older one. The actual change is a one line from a String.equals() to a String.startsWith(). Thanks for a great piece of software, -Chris Gaffney Grand Valley State University -------------- next part -------------- A non-text attachment was scrubbed... Name: libraries_on_classpath_fixed.patch Type: text/x-patch Size: 5617 bytes Desc: Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5d423b8/libraries_on_classpath_fixed-0071.bin From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From thomas.shulok at lmco.com Fri Apr 8 10:38:55 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Fri, 08 Apr 2005 12:38:55 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi Trent, Thanks for the prompt response. Before diving deeper, I was wondering if there is a timeout parameter somewhere in the stack that I have not set properly. Given the nature of the failure (only fails if the line has been idle for a few seconds), it feels like some kind of timeout issue... Thanks again, Thom -----Original Message----- From: rxtx-bounces at mail.linuxgrrls.org [mailto:rxtx-bounces at mail.linuxgrrls.org] On Behalf Of Trent Jarvi Sent: Thursday, April 07, 2005 6:23 PM To: Java RXTX discussion Subject: Re: [Rxtx] Input/output error in writeArray On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a > Windows box. Everything connects up fine, and I can send and receive > a simple sequence of bytes with no problems. However, if around 5 > seconds goes by without me sending something, I get the following when > I attempt to send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at mail.linuxgrrls.org http://mail.linuxgrrls.org/mailman/listinfo/rxtx From ricardo.trindade at emation.pt Mon Apr 4 09:17:23 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Mon, 04 Apr 2005 16:17:23 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot Message-ID: <42515A83.4050907@emation.pt> Hi, I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most recent stable snapshot), and get the following exception : It looks like rxtx has been compiled with jdk 1.5. If this was indeed the case, I think there is a compilation flag that generates code that runs on older jdks. java.lang.UnsupportedClassVersionError: gnu/io/UnsupportedCommOperationException (Unsupported major.minor version 49.0) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at java.net.URLClassLoader.defineClass(URLClassLoader.java:251) at java.net.URLClassLoader.access$100(URLClassLoader.java:55) at java.net.URLClassLoader$1.run(URLClassLoader.java:194) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:187) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:141) I'm trying to run it with 1.4. thanks Ricardo From taj at www.linux.org.uk Tue Apr 5 00:48:12 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 07:48:12 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42515A83.4050907@emation.pt> References: <42515A83.4050907@emation.pt> Message-ID: On Mon, 4 Apr 2005, Ricardo Trindade wrote: > Hi, > > I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most > recent stable snapshot), and get the following exception : > > It looks like rxtx has been compiled with jdk 1.5. If this was > indeed the case, I think there is a compilation flag that generates code > that runs on older jdks. > > java.lang.UnsupportedClassVersionError: > gnu/io/UnsupportedCommOperationException (Unsupported major.minor > version 49.0) [snip] Thanks Ricardo I recompiled the jar with javac -source 1.3 -target 1.3. That should cover most of the JRE's in use today. I also compiled the rxtx 2.0 x86_64 native library which appeared to be missing. I tried looking for flags to pass gcc 4.0 to make the native libraries more backwards compatible but only found options for C++ which is not used in rxtx. I've got a list of other bugs that I'll be going through in the next few weeks but for now I just left them with the same CVS filename - no code changes. ftp://ftp.qbang.org/pub/rxtx/rxtx-2.0-CVS-20050120-bins.tar.gz ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-CVS-20050120-bins.tar.gz -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Tue Apr 5 02:24:33 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 05 Apr 2005 09:24:33 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: References: <42515A83.4050907@emation.pt> Message-ID: <42524B41.3040300@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050405/5919abbb/attachment-0072.html From taj at www.linux.org.uk Tue Apr 5 03:00:29 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 10:00:29 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42524B41.3040300@emation.pt> References: <42515A83.4050907@emation.pt> <42524B41.3040300@emation.pt> Message-ID: On Tue, 5 Apr 2005, Ricardo Trindade wrote: > Will you anounce to the list when a new release is available ? > There will be several incremental releases announced here. Once those are done, we will release 2.1.7 and 2.0.7. -- Trent Jarvi taj at www.linux.org.uk From no_spam at somewhere.com Tue Apr 5 11:55:37 2005 From: no_spam at somewhere.com (no_spam@somewhere.com) Date: Tue, 5 Apr 2005 13:55:37 -0400 Subject: [Rxtx] Closing a port from an event listener results in a deadlock Message-ID: <20050405175537.GA21747@rcog.homelinux.net> On the message I sent on March 14, does anyone had the chance to try the modification? Or was it already fixed? (I haven't searched the archive extensively) Or maybe my message got catched by some spam filters? (it made it to the list archive though) Anyway, I would appreciate some feedback (through the list) Thanks From taj at www.linux.org.uk Tue Apr 5 14:42:28 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 21:42:28 +0100 (BST) Subject: [Rxtx] Closing a port from an event listener results in a deadlock In-Reply-To: <20050405175537.GA21747@rcog.homelinux.net> References: <20050405175537.GA21747@rcog.homelinux.net> Message-ID: On Tue, 5 Apr 2005 no_spam at somewhere.com wrote: > On the message I sent on March 14, does anyone had the chance to try the > modification? > > Or was it already fixed? (I haven't searched the archive extensively) > > Or maybe my message got catched by some spam filters? (it made it to the list > archive though) > > Anyway, I would appreciate some feedback (through the list) > The patch is here http://marc.theaimsgroup.com/?l=rxtx&m=111084488820288&w=2 I have applied this patch to a local copy but will not be doing formal testing for a couple weeks. I do not try to close ports from inside the eventListenter usually so I encourage any feedback also. If there are no problems reported, I expect this will go into rxtx 2.1-7. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Wed Apr 6 08:33:42 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Wed, 06 Apr 2005 15:33:42 +0100 Subject: [Rxtx] getting RXTX version Message-ID: <4253F346.50102@emation.pt> Hi, I want to make sure my deployments have the same version of RXTX jar and native lib. I know the version of the jar can be obtained in the Version class, but how can I obtain the native version ? I know RXTX prints to the console a warning if the version is different. Is there a way to programatically know is this is the case ? I would like to log that to our app's log thanks Ricardo From taj at www.linux.org.uk Wed Apr 6 15:10:20 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 6 Apr 2005 22:10:20 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4253F346.50102@emation.pt> References: <4253F346.50102@emation.pt> Message-ID: On Wed, 6 Apr 2005, Ricardo Trindade wrote: > Hi, > > I want to make sure my deployments have the same version of RXTX jar > and native lib. > > I know the version of the jar can be obtained in the Version class, > but how can I obtain the native version ? > > I know RXTX prints to the console a warning if the version is > different. Is there a way to programatically know is this is the case ? > > I would like to log that to our app's log > There isn't a suggested way of doing that right now. We could move things around and have a static String RXTXVersion.getNativeVersion() in future releases. Is this what you expected? This is not documented in commapi at all. I just tossed that in to catch conflicts while developing. It would be nice to have access in GUI applications though. It may be possible to access RXTXCommDriver.LibVersion right now. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Thu Apr 7 02:51:00 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 09:51:00 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> Message-ID: <4254F474.7020905@emation.pt> >There isn't a suggested way of doing that right now. We could move things >around and have a static String RXTXVersion.getNativeVersion() in future >releases. Is this what you expected? > > Yes, that would be perfect. >This is not documented in commapi at all. I just tossed that in to catch >conflicts while developing. It would be nice to have access in GUI >applications though. > >It may be possible to access RXTXCommDriver.LibVersion right now. > > > I tried, and I don't think it's possible. From taj at www.linux.org.uk Thu Apr 7 03:32:04 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 7 Apr 2005 10:32:04 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4254F474.7020905@emation.pt> References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: On Thu, 7 Apr 2005, Ricardo Trindade wrote: > > >There isn't a suggested way of doing that right now. We could move things > >around and have a static String RXTXVersion.getNativeVersion() in future > >releases. Is this what you expected? > > > > > > Yes, that would be perfect. > The attached should do what you want. You will still need to catch an exception for older versions... -- Trent Jarvi taj at www.linux.org.uk -------------- next part -------------- ? public_version.patch Index: RXTXCommDriver.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXCommDriver.java,v retrieving revision 1.16.2.51 diff -u -r1.16.2.51 RXTXCommDriver.java --- RXTXCommDriver.java 12 Oct 2004 09:13:30 -0000 1.16.2.51 +++ RXTXCommDriver.java 7 Apr 2005 09:29:04 -0000 @@ -54,7 +54,7 @@ the Library. */ String JarVersion = RXTXVersion.getVersion(); - String LibVersion = nativeGetVersion(); + String LibVersion = RXTXVersion.nativeGetVersion(); if ( devel ) { System.out.println("Devel Library"); @@ -76,7 +76,6 @@ /** Get the Serial port prefixes for the running OS */ private String deviceDirectory; private String osName; - private static native String nativeGetVersion(); private native boolean registerKnownPorts(int PortType); private native boolean isPortPrefixValid(String dev); private native boolean testRead(String dev, int type); Index: RXTXVersion.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXVersion.java,v retrieving revision 1.2.2.31 diff -u -r1.2.2.31 RXTXVersion.java --- RXTXVersion.java 16 Oct 2004 16:20:35 -0000 1.2.2.31 +++ RXTXVersion.java 7 Apr 2005 09:29:04 -0000 @@ -36,6 +36,7 @@ private static String Version; static { + System.loadLibrary( "rxtxSerial" ); Version = "RXTX-2.1-7pre20"; } /** @@ -47,4 +48,5 @@ { return(Version); } + public static native String nativeGetVersion(); } Index: SerialImp.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v retrieving revision 1.46.2.181 diff -u -r1.46.2.181 SerialImp.c --- SerialImp.c 17 Oct 2004 09:48:56 -0000 1.46.2.181 +++ SerialImp.c 7 Apr 2005 09:29:07 -0000 @@ -116,6 +116,7 @@ * It will eventually be removed. * */ #define RXTXPort(foo) Java_gnu_io_RXTXPort_ ## foo +#define RXTXVersion(foo) Java_gnu_io_RXTXVersion_ ## foo #define RXTXCommDriver(foo) Java_gnu_io_RXTXCommDriver_ ## foo #if defined(__sun__) || defined(__hpux__) @@ -4001,7 +4002,7 @@ } /*---------------------------------------------------------- -RXTXCommDriver.nativeGetVersion +RXTXVersion.nativeGetVersion accept: none perform: return the current version @@ -4010,9 +4011,10 @@ comments: This is used to avoid mixing versions of the .jar and native library. First introduced in rxtx-1.5-9 + Moved from RXTXCommDriver to RXTXVersion in rxtx-2.1-7 ----------------------------------------------------------*/ -JNIEXPORT jstring JNICALL RXTXCommDriver(nativeGetVersion) (JNIEnv *env, +JNIEXPORT jstring JNICALL RXTXVersion(nativeGetVersion) (JNIEnv *env, jclass jclazz ) { return (*env)->NewStringUTF( env, "RXTX-2.1-7pre20" ); From ricardo.trindade at emation.pt Thu Apr 7 03:45:58 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 10:45:58 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: <42550156.2040908@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050407/05212451/attachment-0072.html From thomas.shulok at lmco.com Thu Apr 7 17:43:11 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Thu, 07 Apr 2005 19:43:11 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi There, I'm attempting to talk RS232 between an embedded Linux box and a Windows box. Everything connects up fine, and I can send and receive a simple sequence of bytes with no problems. However, if around 5 seconds goes by without me sending something, I get the following when I attempt to send. java.io.IOException: Input/output error in writeArray Stack trace: java/lang/Throwable.()V java/lang/Throwable.(Ljava/lang/String;)V java/io/IOException.(Ljava/lang/String;)V gnu/io/RXTXPort.writeArray([BIIZ)V gnu/io/RXTXPort$SerialOutputStream.write([B)V SerialTest.main([Ljava/lang/String;)V If there interval is shorter (say 2 seconds between sends), I have no problems. On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and librxtxSerial-2.0.7pre2.so. Any ideas? Thanks, Thom -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5b23dcf/attachment-0072.html From taj at www.linux.org.uk Thu Apr 7 19:22:36 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:22:36 +0100 (BST) Subject: [Rxtx] Input/output error in writeArray In-Reply-To: References: Message-ID: On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a Windows > box. Everything connects up fine, and I can send and receive a simple > sequence of bytes with no problems. However, if around 5 seconds goes > by without me sending something, I get the following when I attempt to > send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Apr 7 19:24:59 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:24:59 +0100 (BST) Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) Message-ID: hmm. This would not work from applets would it? -- Trent Jarvi taj at www.linux.org.uk ---------- Forwarded message ---------- Date: Thu, 07 Apr 2005 16:05:53 -0400 From: Chris Gaffney To: taj at www.linux.org.uk Subject: RXTX Libraries on Classpath fix Hi, I submitted a patch for RXTX a few weeks ago to allow for loading the native libraries from the classpath. Since sending it to you I found it wasn't working on windows. I've fixed the problem and created a new patch that should replace the older one. The actual change is a one line from a String.equals() to a String.startsWith(). Thanks for a great piece of software, -Chris Gaffney Grand Valley State University -------------- next part -------------- A non-text attachment was scrubbed... Name: libraries_on_classpath_fixed.patch Type: text/x-patch Size: 5617 bytes Desc: Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5d423b8/libraries_on_classpath_fixed-0072.bin From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From thomas.shulok at lmco.com Fri Apr 8 10:38:55 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Fri, 08 Apr 2005 12:38:55 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi Trent, Thanks for the prompt response. Before diving deeper, I was wondering if there is a timeout parameter somewhere in the stack that I have not set properly. Given the nature of the failure (only fails if the line has been idle for a few seconds), it feels like some kind of timeout issue... Thanks again, Thom -----Original Message----- From: rxtx-bounces at mail.linuxgrrls.org [mailto:rxtx-bounces at mail.linuxgrrls.org] On Behalf Of Trent Jarvi Sent: Thursday, April 07, 2005 6:23 PM To: Java RXTX discussion Subject: Re: [Rxtx] Input/output error in writeArray On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a > Windows box. Everything connects up fine, and I can send and receive > a simple sequence of bytes with no problems. However, if around 5 > seconds goes by without me sending something, I get the following when > I attempt to send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at mail.linuxgrrls.org http://mail.linuxgrrls.org/mailman/listinfo/rxtx From ricardo.trindade at emation.pt Mon Apr 4 09:17:23 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Mon, 04 Apr 2005 16:17:23 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot Message-ID: <42515A83.4050907@emation.pt> Hi, I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most recent stable snapshot), and get the following exception : It looks like rxtx has been compiled with jdk 1.5. If this was indeed the case, I think there is a compilation flag that generates code that runs on older jdks. java.lang.UnsupportedClassVersionError: gnu/io/UnsupportedCommOperationException (Unsupported major.minor version 49.0) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at java.net.URLClassLoader.defineClass(URLClassLoader.java:251) at java.net.URLClassLoader.access$100(URLClassLoader.java:55) at java.net.URLClassLoader$1.run(URLClassLoader.java:194) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:187) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:141) I'm trying to run it with 1.4. thanks Ricardo From taj at www.linux.org.uk Tue Apr 5 00:48:12 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 07:48:12 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42515A83.4050907@emation.pt> References: <42515A83.4050907@emation.pt> Message-ID: On Mon, 4 Apr 2005, Ricardo Trindade wrote: > Hi, > > I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most > recent stable snapshot), and get the following exception : > > It looks like rxtx has been compiled with jdk 1.5. If this was > indeed the case, I think there is a compilation flag that generates code > that runs on older jdks. > > java.lang.UnsupportedClassVersionError: > gnu/io/UnsupportedCommOperationException (Unsupported major.minor > version 49.0) [snip] Thanks Ricardo I recompiled the jar with javac -source 1.3 -target 1.3. That should cover most of the JRE's in use today. I also compiled the rxtx 2.0 x86_64 native library which appeared to be missing. I tried looking for flags to pass gcc 4.0 to make the native libraries more backwards compatible but only found options for C++ which is not used in rxtx. I've got a list of other bugs that I'll be going through in the next few weeks but for now I just left them with the same CVS filename - no code changes. ftp://ftp.qbang.org/pub/rxtx/rxtx-2.0-CVS-20050120-bins.tar.gz ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-CVS-20050120-bins.tar.gz -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Tue Apr 5 02:24:33 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 05 Apr 2005 09:24:33 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: References: <42515A83.4050907@emation.pt> Message-ID: <42524B41.3040300@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050405/5919abbb/attachment-0073.html From taj at www.linux.org.uk Tue Apr 5 03:00:29 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 10:00:29 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42524B41.3040300@emation.pt> References: <42515A83.4050907@emation.pt> <42524B41.3040300@emation.pt> Message-ID: On Tue, 5 Apr 2005, Ricardo Trindade wrote: > Will you anounce to the list when a new release is available ? > There will be several incremental releases announced here. Once those are done, we will release 2.1.7 and 2.0.7. -- Trent Jarvi taj at www.linux.org.uk From no_spam at somewhere.com Tue Apr 5 11:55:37 2005 From: no_spam at somewhere.com (no_spam@somewhere.com) Date: Tue, 5 Apr 2005 13:55:37 -0400 Subject: [Rxtx] Closing a port from an event listener results in a deadlock Message-ID: <20050405175537.GA21747@rcog.homelinux.net> On the message I sent on March 14, does anyone had the chance to try the modification? Or was it already fixed? (I haven't searched the archive extensively) Or maybe my message got catched by some spam filters? (it made it to the list archive though) Anyway, I would appreciate some feedback (through the list) Thanks From taj at www.linux.org.uk Tue Apr 5 14:42:28 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 21:42:28 +0100 (BST) Subject: [Rxtx] Closing a port from an event listener results in a deadlock In-Reply-To: <20050405175537.GA21747@rcog.homelinux.net> References: <20050405175537.GA21747@rcog.homelinux.net> Message-ID: On Tue, 5 Apr 2005 no_spam at somewhere.com wrote: > On the message I sent on March 14, does anyone had the chance to try the > modification? > > Or was it already fixed? (I haven't searched the archive extensively) > > Or maybe my message got catched by some spam filters? (it made it to the list > archive though) > > Anyway, I would appreciate some feedback (through the list) > The patch is here http://marc.theaimsgroup.com/?l=rxtx&m=111084488820288&w=2 I have applied this patch to a local copy but will not be doing formal testing for a couple weeks. I do not try to close ports from inside the eventListenter usually so I encourage any feedback also. If there are no problems reported, I expect this will go into rxtx 2.1-7. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Wed Apr 6 08:33:42 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Wed, 06 Apr 2005 15:33:42 +0100 Subject: [Rxtx] getting RXTX version Message-ID: <4253F346.50102@emation.pt> Hi, I want to make sure my deployments have the same version of RXTX jar and native lib. I know the version of the jar can be obtained in the Version class, but how can I obtain the native version ? I know RXTX prints to the console a warning if the version is different. Is there a way to programatically know is this is the case ? I would like to log that to our app's log thanks Ricardo From taj at www.linux.org.uk Wed Apr 6 15:10:20 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 6 Apr 2005 22:10:20 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4253F346.50102@emation.pt> References: <4253F346.50102@emation.pt> Message-ID: On Wed, 6 Apr 2005, Ricardo Trindade wrote: > Hi, > > I want to make sure my deployments have the same version of RXTX jar > and native lib. > > I know the version of the jar can be obtained in the Version class, > but how can I obtain the native version ? > > I know RXTX prints to the console a warning if the version is > different. Is there a way to programatically know is this is the case ? > > I would like to log that to our app's log > There isn't a suggested way of doing that right now. We could move things around and have a static String RXTXVersion.getNativeVersion() in future releases. Is this what you expected? This is not documented in commapi at all. I just tossed that in to catch conflicts while developing. It would be nice to have access in GUI applications though. It may be possible to access RXTXCommDriver.LibVersion right now. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Thu Apr 7 02:51:00 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 09:51:00 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> Message-ID: <4254F474.7020905@emation.pt> >There isn't a suggested way of doing that right now. We could move things >around and have a static String RXTXVersion.getNativeVersion() in future >releases. Is this what you expected? > > Yes, that would be perfect. >This is not documented in commapi at all. I just tossed that in to catch >conflicts while developing. It would be nice to have access in GUI >applications though. > >It may be possible to access RXTXCommDriver.LibVersion right now. > > > I tried, and I don't think it's possible. From taj at www.linux.org.uk Thu Apr 7 03:32:04 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 7 Apr 2005 10:32:04 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4254F474.7020905@emation.pt> References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: On Thu, 7 Apr 2005, Ricardo Trindade wrote: > > >There isn't a suggested way of doing that right now. We could move things > >around and have a static String RXTXVersion.getNativeVersion() in future > >releases. Is this what you expected? > > > > > > Yes, that would be perfect. > The attached should do what you want. You will still need to catch an exception for older versions... -- Trent Jarvi taj at www.linux.org.uk -------------- next part -------------- ? public_version.patch Index: RXTXCommDriver.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXCommDriver.java,v retrieving revision 1.16.2.51 diff -u -r1.16.2.51 RXTXCommDriver.java --- RXTXCommDriver.java 12 Oct 2004 09:13:30 -0000 1.16.2.51 +++ RXTXCommDriver.java 7 Apr 2005 09:29:04 -0000 @@ -54,7 +54,7 @@ the Library. */ String JarVersion = RXTXVersion.getVersion(); - String LibVersion = nativeGetVersion(); + String LibVersion = RXTXVersion.nativeGetVersion(); if ( devel ) { System.out.println("Devel Library"); @@ -76,7 +76,6 @@ /** Get the Serial port prefixes for the running OS */ private String deviceDirectory; private String osName; - private static native String nativeGetVersion(); private native boolean registerKnownPorts(int PortType); private native boolean isPortPrefixValid(String dev); private native boolean testRead(String dev, int type); Index: RXTXVersion.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXVersion.java,v retrieving revision 1.2.2.31 diff -u -r1.2.2.31 RXTXVersion.java --- RXTXVersion.java 16 Oct 2004 16:20:35 -0000 1.2.2.31 +++ RXTXVersion.java 7 Apr 2005 09:29:04 -0000 @@ -36,6 +36,7 @@ private static String Version; static { + System.loadLibrary( "rxtxSerial" ); Version = "RXTX-2.1-7pre20"; } /** @@ -47,4 +48,5 @@ { return(Version); } + public static native String nativeGetVersion(); } Index: SerialImp.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v retrieving revision 1.46.2.181 diff -u -r1.46.2.181 SerialImp.c --- SerialImp.c 17 Oct 2004 09:48:56 -0000 1.46.2.181 +++ SerialImp.c 7 Apr 2005 09:29:07 -0000 @@ -116,6 +116,7 @@ * It will eventually be removed. * */ #define RXTXPort(foo) Java_gnu_io_RXTXPort_ ## foo +#define RXTXVersion(foo) Java_gnu_io_RXTXVersion_ ## foo #define RXTXCommDriver(foo) Java_gnu_io_RXTXCommDriver_ ## foo #if defined(__sun__) || defined(__hpux__) @@ -4001,7 +4002,7 @@ } /*---------------------------------------------------------- -RXTXCommDriver.nativeGetVersion +RXTXVersion.nativeGetVersion accept: none perform: return the current version @@ -4010,9 +4011,10 @@ comments: This is used to avoid mixing versions of the .jar and native library. First introduced in rxtx-1.5-9 + Moved from RXTXCommDriver to RXTXVersion in rxtx-2.1-7 ----------------------------------------------------------*/ -JNIEXPORT jstring JNICALL RXTXCommDriver(nativeGetVersion) (JNIEnv *env, +JNIEXPORT jstring JNICALL RXTXVersion(nativeGetVersion) (JNIEnv *env, jclass jclazz ) { return (*env)->NewStringUTF( env, "RXTX-2.1-7pre20" ); From ricardo.trindade at emation.pt Thu Apr 7 03:45:58 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 10:45:58 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: <42550156.2040908@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050407/05212451/attachment-0073.html From thomas.shulok at lmco.com Thu Apr 7 17:43:11 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Thu, 07 Apr 2005 19:43:11 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi There, I'm attempting to talk RS232 between an embedded Linux box and a Windows box. Everything connects up fine, and I can send and receive a simple sequence of bytes with no problems. However, if around 5 seconds goes by without me sending something, I get the following when I attempt to send. java.io.IOException: Input/output error in writeArray Stack trace: java/lang/Throwable.()V java/lang/Throwable.(Ljava/lang/String;)V java/io/IOException.(Ljava/lang/String;)V gnu/io/RXTXPort.writeArray([BIIZ)V gnu/io/RXTXPort$SerialOutputStream.write([B)V SerialTest.main([Ljava/lang/String;)V If there interval is shorter (say 2 seconds between sends), I have no problems. On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and librxtxSerial-2.0.7pre2.so. Any ideas? Thanks, Thom -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5b23dcf/attachment-0073.html From taj at www.linux.org.uk Thu Apr 7 19:22:36 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:22:36 +0100 (BST) Subject: [Rxtx] Input/output error in writeArray In-Reply-To: References: Message-ID: On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a Windows > box. Everything connects up fine, and I can send and receive a simple > sequence of bytes with no problems. However, if around 5 seconds goes > by without me sending something, I get the following when I attempt to > send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Apr 7 19:24:59 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:24:59 +0100 (BST) Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) Message-ID: hmm. This would not work from applets would it? -- Trent Jarvi taj at www.linux.org.uk ---------- Forwarded message ---------- Date: Thu, 07 Apr 2005 16:05:53 -0400 From: Chris Gaffney To: taj at www.linux.org.uk Subject: RXTX Libraries on Classpath fix Hi, I submitted a patch for RXTX a few weeks ago to allow for loading the native libraries from the classpath. Since sending it to you I found it wasn't working on windows. I've fixed the problem and created a new patch that should replace the older one. The actual change is a one line from a String.equals() to a String.startsWith(). Thanks for a great piece of software, -Chris Gaffney Grand Valley State University -------------- next part -------------- A non-text attachment was scrubbed... Name: libraries_on_classpath_fixed.patch Type: text/x-patch Size: 5617 bytes Desc: Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5d423b8/libraries_on_classpath_fixed-0073.bin From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From thomas.shulok at lmco.com Fri Apr 8 10:38:55 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Fri, 08 Apr 2005 12:38:55 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi Trent, Thanks for the prompt response. Before diving deeper, I was wondering if there is a timeout parameter somewhere in the stack that I have not set properly. Given the nature of the failure (only fails if the line has been idle for a few seconds), it feels like some kind of timeout issue... Thanks again, Thom -----Original Message----- From: rxtx-bounces at mail.linuxgrrls.org [mailto:rxtx-bounces at mail.linuxgrrls.org] On Behalf Of Trent Jarvi Sent: Thursday, April 07, 2005 6:23 PM To: Java RXTX discussion Subject: Re: [Rxtx] Input/output error in writeArray On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a > Windows box. Everything connects up fine, and I can send and receive > a simple sequence of bytes with no problems. However, if around 5 > seconds goes by without me sending something, I get the following when > I attempt to send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at mail.linuxgrrls.org http://mail.linuxgrrls.org/mailman/listinfo/rxtx From ricardo.trindade at emation.pt Mon Apr 4 09:17:23 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Mon, 04 Apr 2005 16:17:23 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot Message-ID: <42515A83.4050907@emation.pt> Hi, I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most recent stable snapshot), and get the following exception : It looks like rxtx has been compiled with jdk 1.5. If this was indeed the case, I think there is a compilation flag that generates code that runs on older jdks. java.lang.UnsupportedClassVersionError: gnu/io/UnsupportedCommOperationException (Unsupported major.minor version 49.0) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at java.net.URLClassLoader.defineClass(URLClassLoader.java:251) at java.net.URLClassLoader.access$100(URLClassLoader.java:55) at java.net.URLClassLoader$1.run(URLClassLoader.java:194) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:187) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:141) I'm trying to run it with 1.4. thanks Ricardo From taj at www.linux.org.uk Tue Apr 5 00:48:12 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 07:48:12 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42515A83.4050907@emation.pt> References: <42515A83.4050907@emation.pt> Message-ID: On Mon, 4 Apr 2005, Ricardo Trindade wrote: > Hi, > > I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most > recent stable snapshot), and get the following exception : > > It looks like rxtx has been compiled with jdk 1.5. If this was > indeed the case, I think there is a compilation flag that generates code > that runs on older jdks. > > java.lang.UnsupportedClassVersionError: > gnu/io/UnsupportedCommOperationException (Unsupported major.minor > version 49.0) [snip] Thanks Ricardo I recompiled the jar with javac -source 1.3 -target 1.3. That should cover most of the JRE's in use today. I also compiled the rxtx 2.0 x86_64 native library which appeared to be missing. I tried looking for flags to pass gcc 4.0 to make the native libraries more backwards compatible but only found options for C++ which is not used in rxtx. I've got a list of other bugs that I'll be going through in the next few weeks but for now I just left them with the same CVS filename - no code changes. ftp://ftp.qbang.org/pub/rxtx/rxtx-2.0-CVS-20050120-bins.tar.gz ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-CVS-20050120-bins.tar.gz -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Tue Apr 5 02:24:33 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 05 Apr 2005 09:24:33 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: References: <42515A83.4050907@emation.pt> Message-ID: <42524B41.3040300@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050405/5919abbb/attachment-0074.html From taj at www.linux.org.uk Tue Apr 5 03:00:29 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 10:00:29 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42524B41.3040300@emation.pt> References: <42515A83.4050907@emation.pt> <42524B41.3040300@emation.pt> Message-ID: On Tue, 5 Apr 2005, Ricardo Trindade wrote: > Will you anounce to the list when a new release is available ? > There will be several incremental releases announced here. Once those are done, we will release 2.1.7 and 2.0.7. -- Trent Jarvi taj at www.linux.org.uk From no_spam at somewhere.com Tue Apr 5 11:55:37 2005 From: no_spam at somewhere.com (no_spam@somewhere.com) Date: Tue, 5 Apr 2005 13:55:37 -0400 Subject: [Rxtx] Closing a port from an event listener results in a deadlock Message-ID: <20050405175537.GA21747@rcog.homelinux.net> On the message I sent on March 14, does anyone had the chance to try the modification? Or was it already fixed? (I haven't searched the archive extensively) Or maybe my message got catched by some spam filters? (it made it to the list archive though) Anyway, I would appreciate some feedback (through the list) Thanks From taj at www.linux.org.uk Tue Apr 5 14:42:28 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 21:42:28 +0100 (BST) Subject: [Rxtx] Closing a port from an event listener results in a deadlock In-Reply-To: <20050405175537.GA21747@rcog.homelinux.net> References: <20050405175537.GA21747@rcog.homelinux.net> Message-ID: On Tue, 5 Apr 2005 no_spam at somewhere.com wrote: > On the message I sent on March 14, does anyone had the chance to try the > modification? > > Or was it already fixed? (I haven't searched the archive extensively) > > Or maybe my message got catched by some spam filters? (it made it to the list > archive though) > > Anyway, I would appreciate some feedback (through the list) > The patch is here http://marc.theaimsgroup.com/?l=rxtx&m=111084488820288&w=2 I have applied this patch to a local copy but will not be doing formal testing for a couple weeks. I do not try to close ports from inside the eventListenter usually so I encourage any feedback also. If there are no problems reported, I expect this will go into rxtx 2.1-7. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Wed Apr 6 08:33:42 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Wed, 06 Apr 2005 15:33:42 +0100 Subject: [Rxtx] getting RXTX version Message-ID: <4253F346.50102@emation.pt> Hi, I want to make sure my deployments have the same version of RXTX jar and native lib. I know the version of the jar can be obtained in the Version class, but how can I obtain the native version ? I know RXTX prints to the console a warning if the version is different. Is there a way to programatically know is this is the case ? I would like to log that to our app's log thanks Ricardo From taj at www.linux.org.uk Wed Apr 6 15:10:20 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 6 Apr 2005 22:10:20 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4253F346.50102@emation.pt> References: <4253F346.50102@emation.pt> Message-ID: On Wed, 6 Apr 2005, Ricardo Trindade wrote: > Hi, > > I want to make sure my deployments have the same version of RXTX jar > and native lib. > > I know the version of the jar can be obtained in the Version class, > but how can I obtain the native version ? > > I know RXTX prints to the console a warning if the version is > different. Is there a way to programatically know is this is the case ? > > I would like to log that to our app's log > There isn't a suggested way of doing that right now. We could move things around and have a static String RXTXVersion.getNativeVersion() in future releases. Is this what you expected? This is not documented in commapi at all. I just tossed that in to catch conflicts while developing. It would be nice to have access in GUI applications though. It may be possible to access RXTXCommDriver.LibVersion right now. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Thu Apr 7 02:51:00 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 09:51:00 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> Message-ID: <4254F474.7020905@emation.pt> >There isn't a suggested way of doing that right now. We could move things >around and have a static String RXTXVersion.getNativeVersion() in future >releases. Is this what you expected? > > Yes, that would be perfect. >This is not documented in commapi at all. I just tossed that in to catch >conflicts while developing. It would be nice to have access in GUI >applications though. > >It may be possible to access RXTXCommDriver.LibVersion right now. > > > I tried, and I don't think it's possible. From taj at www.linux.org.uk Thu Apr 7 03:32:04 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 7 Apr 2005 10:32:04 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4254F474.7020905@emation.pt> References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: On Thu, 7 Apr 2005, Ricardo Trindade wrote: > > >There isn't a suggested way of doing that right now. We could move things > >around and have a static String RXTXVersion.getNativeVersion() in future > >releases. Is this what you expected? > > > > > > Yes, that would be perfect. > The attached should do what you want. You will still need to catch an exception for older versions... -- Trent Jarvi taj at www.linux.org.uk -------------- next part -------------- ? public_version.patch Index: RXTXCommDriver.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXCommDriver.java,v retrieving revision 1.16.2.51 diff -u -r1.16.2.51 RXTXCommDriver.java --- RXTXCommDriver.java 12 Oct 2004 09:13:30 -0000 1.16.2.51 +++ RXTXCommDriver.java 7 Apr 2005 09:29:04 -0000 @@ -54,7 +54,7 @@ the Library. */ String JarVersion = RXTXVersion.getVersion(); - String LibVersion = nativeGetVersion(); + String LibVersion = RXTXVersion.nativeGetVersion(); if ( devel ) { System.out.println("Devel Library"); @@ -76,7 +76,6 @@ /** Get the Serial port prefixes for the running OS */ private String deviceDirectory; private String osName; - private static native String nativeGetVersion(); private native boolean registerKnownPorts(int PortType); private native boolean isPortPrefixValid(String dev); private native boolean testRead(String dev, int type); Index: RXTXVersion.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXVersion.java,v retrieving revision 1.2.2.31 diff -u -r1.2.2.31 RXTXVersion.java --- RXTXVersion.java 16 Oct 2004 16:20:35 -0000 1.2.2.31 +++ RXTXVersion.java 7 Apr 2005 09:29:04 -0000 @@ -36,6 +36,7 @@ private static String Version; static { + System.loadLibrary( "rxtxSerial" ); Version = "RXTX-2.1-7pre20"; } /** @@ -47,4 +48,5 @@ { return(Version); } + public static native String nativeGetVersion(); } Index: SerialImp.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v retrieving revision 1.46.2.181 diff -u -r1.46.2.181 SerialImp.c --- SerialImp.c 17 Oct 2004 09:48:56 -0000 1.46.2.181 +++ SerialImp.c 7 Apr 2005 09:29:07 -0000 @@ -116,6 +116,7 @@ * It will eventually be removed. * */ #define RXTXPort(foo) Java_gnu_io_RXTXPort_ ## foo +#define RXTXVersion(foo) Java_gnu_io_RXTXVersion_ ## foo #define RXTXCommDriver(foo) Java_gnu_io_RXTXCommDriver_ ## foo #if defined(__sun__) || defined(__hpux__) @@ -4001,7 +4002,7 @@ } /*---------------------------------------------------------- -RXTXCommDriver.nativeGetVersion +RXTXVersion.nativeGetVersion accept: none perform: return the current version @@ -4010,9 +4011,10 @@ comments: This is used to avoid mixing versions of the .jar and native library. First introduced in rxtx-1.5-9 + Moved from RXTXCommDriver to RXTXVersion in rxtx-2.1-7 ----------------------------------------------------------*/ -JNIEXPORT jstring JNICALL RXTXCommDriver(nativeGetVersion) (JNIEnv *env, +JNIEXPORT jstring JNICALL RXTXVersion(nativeGetVersion) (JNIEnv *env, jclass jclazz ) { return (*env)->NewStringUTF( env, "RXTX-2.1-7pre20" ); From ricardo.trindade at emation.pt Thu Apr 7 03:45:58 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 10:45:58 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: <42550156.2040908@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050407/05212451/attachment-0074.html From thomas.shulok at lmco.com Thu Apr 7 17:43:11 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Thu, 07 Apr 2005 19:43:11 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi There, I'm attempting to talk RS232 between an embedded Linux box and a Windows box. Everything connects up fine, and I can send and receive a simple sequence of bytes with no problems. However, if around 5 seconds goes by without me sending something, I get the following when I attempt to send. java.io.IOException: Input/output error in writeArray Stack trace: java/lang/Throwable.()V java/lang/Throwable.(Ljava/lang/String;)V java/io/IOException.(Ljava/lang/String;)V gnu/io/RXTXPort.writeArray([BIIZ)V gnu/io/RXTXPort$SerialOutputStream.write([B)V SerialTest.main([Ljava/lang/String;)V If there interval is shorter (say 2 seconds between sends), I have no problems. On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and librxtxSerial-2.0.7pre2.so. Any ideas? Thanks, Thom -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5b23dcf/attachment-0074.html From taj at www.linux.org.uk Thu Apr 7 19:22:36 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:22:36 +0100 (BST) Subject: [Rxtx] Input/output error in writeArray In-Reply-To: References: Message-ID: On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a Windows > box. Everything connects up fine, and I can send and receive a simple > sequence of bytes with no problems. However, if around 5 seconds goes > by without me sending something, I get the following when I attempt to > send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Apr 7 19:24:59 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:24:59 +0100 (BST) Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) Message-ID: hmm. This would not work from applets would it? -- Trent Jarvi taj at www.linux.org.uk ---------- Forwarded message ---------- Date: Thu, 07 Apr 2005 16:05:53 -0400 From: Chris Gaffney To: taj at www.linux.org.uk Subject: RXTX Libraries on Classpath fix Hi, I submitted a patch for RXTX a few weeks ago to allow for loading the native libraries from the classpath. Since sending it to you I found it wasn't working on windows. I've fixed the problem and created a new patch that should replace the older one. The actual change is a one line from a String.equals() to a String.startsWith(). Thanks for a great piece of software, -Chris Gaffney Grand Valley State University -------------- next part -------------- A non-text attachment was scrubbed... Name: libraries_on_classpath_fixed.patch Type: text/x-patch Size: 5617 bytes Desc: Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5d423b8/libraries_on_classpath_fixed-0074.bin From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From thomas.shulok at lmco.com Fri Apr 8 10:38:55 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Fri, 08 Apr 2005 12:38:55 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi Trent, Thanks for the prompt response. Before diving deeper, I was wondering if there is a timeout parameter somewhere in the stack that I have not set properly. Given the nature of the failure (only fails if the line has been idle for a few seconds), it feels like some kind of timeout issue... Thanks again, Thom -----Original Message----- From: rxtx-bounces at mail.linuxgrrls.org [mailto:rxtx-bounces at mail.linuxgrrls.org] On Behalf Of Trent Jarvi Sent: Thursday, April 07, 2005 6:23 PM To: Java RXTX discussion Subject: Re: [Rxtx] Input/output error in writeArray On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a > Windows box. Everything connects up fine, and I can send and receive > a simple sequence of bytes with no problems. However, if around 5 > seconds goes by without me sending something, I get the following when > I attempt to send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at mail.linuxgrrls.org http://mail.linuxgrrls.org/mailman/listinfo/rxtx From ricardo.trindade at emation.pt Mon Apr 4 09:17:23 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Mon, 04 Apr 2005 16:17:23 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot Message-ID: <42515A83.4050907@emation.pt> Hi, I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most recent stable snapshot), and get the following exception : It looks like rxtx has been compiled with jdk 1.5. If this was indeed the case, I think there is a compilation flag that generates code that runs on older jdks. java.lang.UnsupportedClassVersionError: gnu/io/UnsupportedCommOperationException (Unsupported major.minor version 49.0) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at java.net.URLClassLoader.defineClass(URLClassLoader.java:251) at java.net.URLClassLoader.access$100(URLClassLoader.java:55) at java.net.URLClassLoader$1.run(URLClassLoader.java:194) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:187) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:141) I'm trying to run it with 1.4. thanks Ricardo From taj at www.linux.org.uk Tue Apr 5 00:48:12 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 07:48:12 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42515A83.4050907@emation.pt> References: <42515A83.4050907@emation.pt> Message-ID: On Mon, 4 Apr 2005, Ricardo Trindade wrote: > Hi, > > I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most > recent stable snapshot), and get the following exception : > > It looks like rxtx has been compiled with jdk 1.5. If this was > indeed the case, I think there is a compilation flag that generates code > that runs on older jdks. > > java.lang.UnsupportedClassVersionError: > gnu/io/UnsupportedCommOperationException (Unsupported major.minor > version 49.0) [snip] Thanks Ricardo I recompiled the jar with javac -source 1.3 -target 1.3. That should cover most of the JRE's in use today. I also compiled the rxtx 2.0 x86_64 native library which appeared to be missing. I tried looking for flags to pass gcc 4.0 to make the native libraries more backwards compatible but only found options for C++ which is not used in rxtx. I've got a list of other bugs that I'll be going through in the next few weeks but for now I just left them with the same CVS filename - no code changes. ftp://ftp.qbang.org/pub/rxtx/rxtx-2.0-CVS-20050120-bins.tar.gz ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-CVS-20050120-bins.tar.gz -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Tue Apr 5 02:24:33 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 05 Apr 2005 09:24:33 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: References: <42515A83.4050907@emation.pt> Message-ID: <42524B41.3040300@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050405/5919abbb/attachment-0075.html From taj at www.linux.org.uk Tue Apr 5 03:00:29 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 10:00:29 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42524B41.3040300@emation.pt> References: <42515A83.4050907@emation.pt> <42524B41.3040300@emation.pt> Message-ID: On Tue, 5 Apr 2005, Ricardo Trindade wrote: > Will you anounce to the list when a new release is available ? > There will be several incremental releases announced here. Once those are done, we will release 2.1.7 and 2.0.7. -- Trent Jarvi taj at www.linux.org.uk From no_spam at somewhere.com Tue Apr 5 11:55:37 2005 From: no_spam at somewhere.com (no_spam@somewhere.com) Date: Tue, 5 Apr 2005 13:55:37 -0400 Subject: [Rxtx] Closing a port from an event listener results in a deadlock Message-ID: <20050405175537.GA21747@rcog.homelinux.net> On the message I sent on March 14, does anyone had the chance to try the modification? Or was it already fixed? (I haven't searched the archive extensively) Or maybe my message got catched by some spam filters? (it made it to the list archive though) Anyway, I would appreciate some feedback (through the list) Thanks From taj at www.linux.org.uk Tue Apr 5 14:42:28 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 21:42:28 +0100 (BST) Subject: [Rxtx] Closing a port from an event listener results in a deadlock In-Reply-To: <20050405175537.GA21747@rcog.homelinux.net> References: <20050405175537.GA21747@rcog.homelinux.net> Message-ID: On Tue, 5 Apr 2005 no_spam at somewhere.com wrote: > On the message I sent on March 14, does anyone had the chance to try the > modification? > > Or was it already fixed? (I haven't searched the archive extensively) > > Or maybe my message got catched by some spam filters? (it made it to the list > archive though) > > Anyway, I would appreciate some feedback (through the list) > The patch is here http://marc.theaimsgroup.com/?l=rxtx&m=111084488820288&w=2 I have applied this patch to a local copy but will not be doing formal testing for a couple weeks. I do not try to close ports from inside the eventListenter usually so I encourage any feedback also. If there are no problems reported, I expect this will go into rxtx 2.1-7. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Wed Apr 6 08:33:42 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Wed, 06 Apr 2005 15:33:42 +0100 Subject: [Rxtx] getting RXTX version Message-ID: <4253F346.50102@emation.pt> Hi, I want to make sure my deployments have the same version of RXTX jar and native lib. I know the version of the jar can be obtained in the Version class, but how can I obtain the native version ? I know RXTX prints to the console a warning if the version is different. Is there a way to programatically know is this is the case ? I would like to log that to our app's log thanks Ricardo From taj at www.linux.org.uk Wed Apr 6 15:10:20 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 6 Apr 2005 22:10:20 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4253F346.50102@emation.pt> References: <4253F346.50102@emation.pt> Message-ID: On Wed, 6 Apr 2005, Ricardo Trindade wrote: > Hi, > > I want to make sure my deployments have the same version of RXTX jar > and native lib. > > I know the version of the jar can be obtained in the Version class, > but how can I obtain the native version ? > > I know RXTX prints to the console a warning if the version is > different. Is there a way to programatically know is this is the case ? > > I would like to log that to our app's log > There isn't a suggested way of doing that right now. We could move things around and have a static String RXTXVersion.getNativeVersion() in future releases. Is this what you expected? This is not documented in commapi at all. I just tossed that in to catch conflicts while developing. It would be nice to have access in GUI applications though. It may be possible to access RXTXCommDriver.LibVersion right now. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Thu Apr 7 02:51:00 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 09:51:00 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> Message-ID: <4254F474.7020905@emation.pt> >There isn't a suggested way of doing that right now. We could move things >around and have a static String RXTXVersion.getNativeVersion() in future >releases. Is this what you expected? > > Yes, that would be perfect. >This is not documented in commapi at all. I just tossed that in to catch >conflicts while developing. It would be nice to have access in GUI >applications though. > >It may be possible to access RXTXCommDriver.LibVersion right now. > > > I tried, and I don't think it's possible. From taj at www.linux.org.uk Thu Apr 7 03:32:04 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 7 Apr 2005 10:32:04 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4254F474.7020905@emation.pt> References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: On Thu, 7 Apr 2005, Ricardo Trindade wrote: > > >There isn't a suggested way of doing that right now. We could move things > >around and have a static String RXTXVersion.getNativeVersion() in future > >releases. Is this what you expected? > > > > > > Yes, that would be perfect. > The attached should do what you want. You will still need to catch an exception for older versions... -- Trent Jarvi taj at www.linux.org.uk -------------- next part -------------- ? public_version.patch Index: RXTXCommDriver.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXCommDriver.java,v retrieving revision 1.16.2.51 diff -u -r1.16.2.51 RXTXCommDriver.java --- RXTXCommDriver.java 12 Oct 2004 09:13:30 -0000 1.16.2.51 +++ RXTXCommDriver.java 7 Apr 2005 09:29:04 -0000 @@ -54,7 +54,7 @@ the Library. */ String JarVersion = RXTXVersion.getVersion(); - String LibVersion = nativeGetVersion(); + String LibVersion = RXTXVersion.nativeGetVersion(); if ( devel ) { System.out.println("Devel Library"); @@ -76,7 +76,6 @@ /** Get the Serial port prefixes for the running OS */ private String deviceDirectory; private String osName; - private static native String nativeGetVersion(); private native boolean registerKnownPorts(int PortType); private native boolean isPortPrefixValid(String dev); private native boolean testRead(String dev, int type); Index: RXTXVersion.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXVersion.java,v retrieving revision 1.2.2.31 diff -u -r1.2.2.31 RXTXVersion.java --- RXTXVersion.java 16 Oct 2004 16:20:35 -0000 1.2.2.31 +++ RXTXVersion.java 7 Apr 2005 09:29:04 -0000 @@ -36,6 +36,7 @@ private static String Version; static { + System.loadLibrary( "rxtxSerial" ); Version = "RXTX-2.1-7pre20"; } /** @@ -47,4 +48,5 @@ { return(Version); } + public static native String nativeGetVersion(); } Index: SerialImp.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v retrieving revision 1.46.2.181 diff -u -r1.46.2.181 SerialImp.c --- SerialImp.c 17 Oct 2004 09:48:56 -0000 1.46.2.181 +++ SerialImp.c 7 Apr 2005 09:29:07 -0000 @@ -116,6 +116,7 @@ * It will eventually be removed. * */ #define RXTXPort(foo) Java_gnu_io_RXTXPort_ ## foo +#define RXTXVersion(foo) Java_gnu_io_RXTXVersion_ ## foo #define RXTXCommDriver(foo) Java_gnu_io_RXTXCommDriver_ ## foo #if defined(__sun__) || defined(__hpux__) @@ -4001,7 +4002,7 @@ } /*---------------------------------------------------------- -RXTXCommDriver.nativeGetVersion +RXTXVersion.nativeGetVersion accept: none perform: return the current version @@ -4010,9 +4011,10 @@ comments: This is used to avoid mixing versions of the .jar and native library. First introduced in rxtx-1.5-9 + Moved from RXTXCommDriver to RXTXVersion in rxtx-2.1-7 ----------------------------------------------------------*/ -JNIEXPORT jstring JNICALL RXTXCommDriver(nativeGetVersion) (JNIEnv *env, +JNIEXPORT jstring JNICALL RXTXVersion(nativeGetVersion) (JNIEnv *env, jclass jclazz ) { return (*env)->NewStringUTF( env, "RXTX-2.1-7pre20" ); From ricardo.trindade at emation.pt Thu Apr 7 03:45:58 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 10:45:58 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: <42550156.2040908@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050407/05212451/attachment-0075.html From thomas.shulok at lmco.com Thu Apr 7 17:43:11 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Thu, 07 Apr 2005 19:43:11 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi There, I'm attempting to talk RS232 between an embedded Linux box and a Windows box. Everything connects up fine, and I can send and receive a simple sequence of bytes with no problems. However, if around 5 seconds goes by without me sending something, I get the following when I attempt to send. java.io.IOException: Input/output error in writeArray Stack trace: java/lang/Throwable.()V java/lang/Throwable.(Ljava/lang/String;)V java/io/IOException.(Ljava/lang/String;)V gnu/io/RXTXPort.writeArray([BIIZ)V gnu/io/RXTXPort$SerialOutputStream.write([B)V SerialTest.main([Ljava/lang/String;)V If there interval is shorter (say 2 seconds between sends), I have no problems. On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and librxtxSerial-2.0.7pre2.so. Any ideas? Thanks, Thom -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5b23dcf/attachment-0075.html From taj at www.linux.org.uk Thu Apr 7 19:22:36 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:22:36 +0100 (BST) Subject: [Rxtx] Input/output error in writeArray In-Reply-To: References: Message-ID: On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a Windows > box. Everything connects up fine, and I can send and receive a simple > sequence of bytes with no problems. However, if around 5 seconds goes > by without me sending something, I get the following when I attempt to > send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Apr 7 19:24:59 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:24:59 +0100 (BST) Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) Message-ID: hmm. This would not work from applets would it? -- Trent Jarvi taj at www.linux.org.uk ---------- Forwarded message ---------- Date: Thu, 07 Apr 2005 16:05:53 -0400 From: Chris Gaffney To: taj at www.linux.org.uk Subject: RXTX Libraries on Classpath fix Hi, I submitted a patch for RXTX a few weeks ago to allow for loading the native libraries from the classpath. Since sending it to you I found it wasn't working on windows. I've fixed the problem and created a new patch that should replace the older one. The actual change is a one line from a String.equals() to a String.startsWith(). Thanks for a great piece of software, -Chris Gaffney Grand Valley State University -------------- next part -------------- A non-text attachment was scrubbed... Name: libraries_on_classpath_fixed.patch Type: text/x-patch Size: 5617 bytes Desc: Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5d423b8/libraries_on_classpath_fixed-0075.bin From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From thomas.shulok at lmco.com Fri Apr 8 10:38:55 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Fri, 08 Apr 2005 12:38:55 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi Trent, Thanks for the prompt response. Before diving deeper, I was wondering if there is a timeout parameter somewhere in the stack that I have not set properly. Given the nature of the failure (only fails if the line has been idle for a few seconds), it feels like some kind of timeout issue... Thanks again, Thom -----Original Message----- From: rxtx-bounces at mail.linuxgrrls.org [mailto:rxtx-bounces at mail.linuxgrrls.org] On Behalf Of Trent Jarvi Sent: Thursday, April 07, 2005 6:23 PM To: Java RXTX discussion Subject: Re: [Rxtx] Input/output error in writeArray On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a > Windows box. Everything connects up fine, and I can send and receive > a simple sequence of bytes with no problems. However, if around 5 > seconds goes by without me sending something, I get the following when > I attempt to send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at mail.linuxgrrls.org http://mail.linuxgrrls.org/mailman/listinfo/rxtx From ricardo.trindade at emation.pt Mon Apr 4 09:17:23 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Mon, 04 Apr 2005 16:17:23 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot Message-ID: <42515A83.4050907@emation.pt> Hi, I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most recent stable snapshot), and get the following exception : It looks like rxtx has been compiled with jdk 1.5. If this was indeed the case, I think there is a compilation flag that generates code that runs on older jdks. java.lang.UnsupportedClassVersionError: gnu/io/UnsupportedCommOperationException (Unsupported major.minor version 49.0) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at java.net.URLClassLoader.defineClass(URLClassLoader.java:251) at java.net.URLClassLoader.access$100(URLClassLoader.java:55) at java.net.URLClassLoader$1.run(URLClassLoader.java:194) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:187) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:141) I'm trying to run it with 1.4. thanks Ricardo From taj at www.linux.org.uk Tue Apr 5 00:48:12 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 07:48:12 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42515A83.4050907@emation.pt> References: <42515A83.4050907@emation.pt> Message-ID: On Mon, 4 Apr 2005, Ricardo Trindade wrote: > Hi, > > I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most > recent stable snapshot), and get the following exception : > > It looks like rxtx has been compiled with jdk 1.5. If this was > indeed the case, I think there is a compilation flag that generates code > that runs on older jdks. > > java.lang.UnsupportedClassVersionError: > gnu/io/UnsupportedCommOperationException (Unsupported major.minor > version 49.0) [snip] Thanks Ricardo I recompiled the jar with javac -source 1.3 -target 1.3. That should cover most of the JRE's in use today. I also compiled the rxtx 2.0 x86_64 native library which appeared to be missing. I tried looking for flags to pass gcc 4.0 to make the native libraries more backwards compatible but only found options for C++ which is not used in rxtx. I've got a list of other bugs that I'll be going through in the next few weeks but for now I just left them with the same CVS filename - no code changes. ftp://ftp.qbang.org/pub/rxtx/rxtx-2.0-CVS-20050120-bins.tar.gz ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-CVS-20050120-bins.tar.gz -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Tue Apr 5 02:24:33 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 05 Apr 2005 09:24:33 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: References: <42515A83.4050907@emation.pt> Message-ID: <42524B41.3040300@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050405/5919abbb/attachment-0076.html From taj at www.linux.org.uk Tue Apr 5 03:00:29 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 10:00:29 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42524B41.3040300@emation.pt> References: <42515A83.4050907@emation.pt> <42524B41.3040300@emation.pt> Message-ID: On Tue, 5 Apr 2005, Ricardo Trindade wrote: > Will you anounce to the list when a new release is available ? > There will be several incremental releases announced here. Once those are done, we will release 2.1.7 and 2.0.7. -- Trent Jarvi taj at www.linux.org.uk From no_spam at somewhere.com Tue Apr 5 11:55:37 2005 From: no_spam at somewhere.com (no_spam@somewhere.com) Date: Tue, 5 Apr 2005 13:55:37 -0400 Subject: [Rxtx] Closing a port from an event listener results in a deadlock Message-ID: <20050405175537.GA21747@rcog.homelinux.net> On the message I sent on March 14, does anyone had the chance to try the modification? Or was it already fixed? (I haven't searched the archive extensively) Or maybe my message got catched by some spam filters? (it made it to the list archive though) Anyway, I would appreciate some feedback (through the list) Thanks From taj at www.linux.org.uk Tue Apr 5 14:42:28 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 21:42:28 +0100 (BST) Subject: [Rxtx] Closing a port from an event listener results in a deadlock In-Reply-To: <20050405175537.GA21747@rcog.homelinux.net> References: <20050405175537.GA21747@rcog.homelinux.net> Message-ID: On Tue, 5 Apr 2005 no_spam at somewhere.com wrote: > On the message I sent on March 14, does anyone had the chance to try the > modification? > > Or was it already fixed? (I haven't searched the archive extensively) > > Or maybe my message got catched by some spam filters? (it made it to the list > archive though) > > Anyway, I would appreciate some feedback (through the list) > The patch is here http://marc.theaimsgroup.com/?l=rxtx&m=111084488820288&w=2 I have applied this patch to a local copy but will not be doing formal testing for a couple weeks. I do not try to close ports from inside the eventListenter usually so I encourage any feedback also. If there are no problems reported, I expect this will go into rxtx 2.1-7. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Wed Apr 6 08:33:42 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Wed, 06 Apr 2005 15:33:42 +0100 Subject: [Rxtx] getting RXTX version Message-ID: <4253F346.50102@emation.pt> Hi, I want to make sure my deployments have the same version of RXTX jar and native lib. I know the version of the jar can be obtained in the Version class, but how can I obtain the native version ? I know RXTX prints to the console a warning if the version is different. Is there a way to programatically know is this is the case ? I would like to log that to our app's log thanks Ricardo From taj at www.linux.org.uk Wed Apr 6 15:10:20 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 6 Apr 2005 22:10:20 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4253F346.50102@emation.pt> References: <4253F346.50102@emation.pt> Message-ID: On Wed, 6 Apr 2005, Ricardo Trindade wrote: > Hi, > > I want to make sure my deployments have the same version of RXTX jar > and native lib. > > I know the version of the jar can be obtained in the Version class, > but how can I obtain the native version ? > > I know RXTX prints to the console a warning if the version is > different. Is there a way to programatically know is this is the case ? > > I would like to log that to our app's log > There isn't a suggested way of doing that right now. We could move things around and have a static String RXTXVersion.getNativeVersion() in future releases. Is this what you expected? This is not documented in commapi at all. I just tossed that in to catch conflicts while developing. It would be nice to have access in GUI applications though. It may be possible to access RXTXCommDriver.LibVersion right now. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Thu Apr 7 02:51:00 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 09:51:00 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> Message-ID: <4254F474.7020905@emation.pt> >There isn't a suggested way of doing that right now. We could move things >around and have a static String RXTXVersion.getNativeVersion() in future >releases. Is this what you expected? > > Yes, that would be perfect. >This is not documented in commapi at all. I just tossed that in to catch >conflicts while developing. It would be nice to have access in GUI >applications though. > >It may be possible to access RXTXCommDriver.LibVersion right now. > > > I tried, and I don't think it's possible. From taj at www.linux.org.uk Thu Apr 7 03:32:04 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 7 Apr 2005 10:32:04 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4254F474.7020905@emation.pt> References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: On Thu, 7 Apr 2005, Ricardo Trindade wrote: > > >There isn't a suggested way of doing that right now. We could move things > >around and have a static String RXTXVersion.getNativeVersion() in future > >releases. Is this what you expected? > > > > > > Yes, that would be perfect. > The attached should do what you want. You will still need to catch an exception for older versions... -- Trent Jarvi taj at www.linux.org.uk -------------- next part -------------- ? public_version.patch Index: RXTXCommDriver.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXCommDriver.java,v retrieving revision 1.16.2.51 diff -u -r1.16.2.51 RXTXCommDriver.java --- RXTXCommDriver.java 12 Oct 2004 09:13:30 -0000 1.16.2.51 +++ RXTXCommDriver.java 7 Apr 2005 09:29:04 -0000 @@ -54,7 +54,7 @@ the Library. */ String JarVersion = RXTXVersion.getVersion(); - String LibVersion = nativeGetVersion(); + String LibVersion = RXTXVersion.nativeGetVersion(); if ( devel ) { System.out.println("Devel Library"); @@ -76,7 +76,6 @@ /** Get the Serial port prefixes for the running OS */ private String deviceDirectory; private String osName; - private static native String nativeGetVersion(); private native boolean registerKnownPorts(int PortType); private native boolean isPortPrefixValid(String dev); private native boolean testRead(String dev, int type); Index: RXTXVersion.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXVersion.java,v retrieving revision 1.2.2.31 diff -u -r1.2.2.31 RXTXVersion.java --- RXTXVersion.java 16 Oct 2004 16:20:35 -0000 1.2.2.31 +++ RXTXVersion.java 7 Apr 2005 09:29:04 -0000 @@ -36,6 +36,7 @@ private static String Version; static { + System.loadLibrary( "rxtxSerial" ); Version = "RXTX-2.1-7pre20"; } /** @@ -47,4 +48,5 @@ { return(Version); } + public static native String nativeGetVersion(); } Index: SerialImp.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v retrieving revision 1.46.2.181 diff -u -r1.46.2.181 SerialImp.c --- SerialImp.c 17 Oct 2004 09:48:56 -0000 1.46.2.181 +++ SerialImp.c 7 Apr 2005 09:29:07 -0000 @@ -116,6 +116,7 @@ * It will eventually be removed. * */ #define RXTXPort(foo) Java_gnu_io_RXTXPort_ ## foo +#define RXTXVersion(foo) Java_gnu_io_RXTXVersion_ ## foo #define RXTXCommDriver(foo) Java_gnu_io_RXTXCommDriver_ ## foo #if defined(__sun__) || defined(__hpux__) @@ -4001,7 +4002,7 @@ } /*---------------------------------------------------------- -RXTXCommDriver.nativeGetVersion +RXTXVersion.nativeGetVersion accept: none perform: return the current version @@ -4010,9 +4011,10 @@ comments: This is used to avoid mixing versions of the .jar and native library. First introduced in rxtx-1.5-9 + Moved from RXTXCommDriver to RXTXVersion in rxtx-2.1-7 ----------------------------------------------------------*/ -JNIEXPORT jstring JNICALL RXTXCommDriver(nativeGetVersion) (JNIEnv *env, +JNIEXPORT jstring JNICALL RXTXVersion(nativeGetVersion) (JNIEnv *env, jclass jclazz ) { return (*env)->NewStringUTF( env, "RXTX-2.1-7pre20" ); From ricardo.trindade at emation.pt Thu Apr 7 03:45:58 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 10:45:58 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: <42550156.2040908@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050407/05212451/attachment-0076.html From thomas.shulok at lmco.com Thu Apr 7 17:43:11 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Thu, 07 Apr 2005 19:43:11 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi There, I'm attempting to talk RS232 between an embedded Linux box and a Windows box. Everything connects up fine, and I can send and receive a simple sequence of bytes with no problems. However, if around 5 seconds goes by without me sending something, I get the following when I attempt to send. java.io.IOException: Input/output error in writeArray Stack trace: java/lang/Throwable.()V java/lang/Throwable.(Ljava/lang/String;)V java/io/IOException.(Ljava/lang/String;)V gnu/io/RXTXPort.writeArray([BIIZ)V gnu/io/RXTXPort$SerialOutputStream.write([B)V SerialTest.main([Ljava/lang/String;)V If there interval is shorter (say 2 seconds between sends), I have no problems. On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and librxtxSerial-2.0.7pre2.so. Any ideas? Thanks, Thom -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5b23dcf/attachment-0076.html From taj at www.linux.org.uk Thu Apr 7 19:22:36 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:22:36 +0100 (BST) Subject: [Rxtx] Input/output error in writeArray In-Reply-To: References: Message-ID: On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a Windows > box. Everything connects up fine, and I can send and receive a simple > sequence of bytes with no problems. However, if around 5 seconds goes > by without me sending something, I get the following when I attempt to > send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Apr 7 19:24:59 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:24:59 +0100 (BST) Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) Message-ID: hmm. This would not work from applets would it? -- Trent Jarvi taj at www.linux.org.uk ---------- Forwarded message ---------- Date: Thu, 07 Apr 2005 16:05:53 -0400 From: Chris Gaffney To: taj at www.linux.org.uk Subject: RXTX Libraries on Classpath fix Hi, I submitted a patch for RXTX a few weeks ago to allow for loading the native libraries from the classpath. Since sending it to you I found it wasn't working on windows. I've fixed the problem and created a new patch that should replace the older one. The actual change is a one line from a String.equals() to a String.startsWith(). Thanks for a great piece of software, -Chris Gaffney Grand Valley State University -------------- next part -------------- A non-text attachment was scrubbed... Name: libraries_on_classpath_fixed.patch Type: text/x-patch Size: 5617 bytes Desc: Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5d423b8/libraries_on_classpath_fixed-0076.bin From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From thomas.shulok at lmco.com Fri Apr 8 10:38:55 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Fri, 08 Apr 2005 12:38:55 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi Trent, Thanks for the prompt response. Before diving deeper, I was wondering if there is a timeout parameter somewhere in the stack that I have not set properly. Given the nature of the failure (only fails if the line has been idle for a few seconds), it feels like some kind of timeout issue... Thanks again, Thom -----Original Message----- From: rxtx-bounces at mail.linuxgrrls.org [mailto:rxtx-bounces at mail.linuxgrrls.org] On Behalf Of Trent Jarvi Sent: Thursday, April 07, 2005 6:23 PM To: Java RXTX discussion Subject: Re: [Rxtx] Input/output error in writeArray On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a > Windows box. Everything connects up fine, and I can send and receive > a simple sequence of bytes with no problems. However, if around 5 > seconds goes by without me sending something, I get the following when > I attempt to send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at mail.linuxgrrls.org http://mail.linuxgrrls.org/mailman/listinfo/rxtx From ricardo.trindade at emation.pt Mon Apr 4 09:17:23 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Mon, 04 Apr 2005 16:17:23 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot Message-ID: <42515A83.4050907@emation.pt> Hi, I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most recent stable snapshot), and get the following exception : It looks like rxtx has been compiled with jdk 1.5. If this was indeed the case, I think there is a compilation flag that generates code that runs on older jdks. java.lang.UnsupportedClassVersionError: gnu/io/UnsupportedCommOperationException (Unsupported major.minor version 49.0) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at java.net.URLClassLoader.defineClass(URLClassLoader.java:251) at java.net.URLClassLoader.access$100(URLClassLoader.java:55) at java.net.URLClassLoader$1.run(URLClassLoader.java:194) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:187) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:141) I'm trying to run it with 1.4. thanks Ricardo From taj at www.linux.org.uk Tue Apr 5 00:48:12 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 07:48:12 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42515A83.4050907@emation.pt> References: <42515A83.4050907@emation.pt> Message-ID: On Mon, 4 Apr 2005, Ricardo Trindade wrote: > Hi, > > I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most > recent stable snapshot), and get the following exception : > > It looks like rxtx has been compiled with jdk 1.5. If this was > indeed the case, I think there is a compilation flag that generates code > that runs on older jdks. > > java.lang.UnsupportedClassVersionError: > gnu/io/UnsupportedCommOperationException (Unsupported major.minor > version 49.0) [snip] Thanks Ricardo I recompiled the jar with javac -source 1.3 -target 1.3. That should cover most of the JRE's in use today. I also compiled the rxtx 2.0 x86_64 native library which appeared to be missing. I tried looking for flags to pass gcc 4.0 to make the native libraries more backwards compatible but only found options for C++ which is not used in rxtx. I've got a list of other bugs that I'll be going through in the next few weeks but for now I just left them with the same CVS filename - no code changes. ftp://ftp.qbang.org/pub/rxtx/rxtx-2.0-CVS-20050120-bins.tar.gz ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-CVS-20050120-bins.tar.gz -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Tue Apr 5 02:24:33 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 05 Apr 2005 09:24:33 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: References: <42515A83.4050907@emation.pt> Message-ID: <42524B41.3040300@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050405/5919abbb/attachment-0077.html From taj at www.linux.org.uk Tue Apr 5 03:00:29 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 10:00:29 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42524B41.3040300@emation.pt> References: <42515A83.4050907@emation.pt> <42524B41.3040300@emation.pt> Message-ID: On Tue, 5 Apr 2005, Ricardo Trindade wrote: > Will you anounce to the list when a new release is available ? > There will be several incremental releases announced here. Once those are done, we will release 2.1.7 and 2.0.7. -- Trent Jarvi taj at www.linux.org.uk From no_spam at somewhere.com Tue Apr 5 11:55:37 2005 From: no_spam at somewhere.com (no_spam@somewhere.com) Date: Tue, 5 Apr 2005 13:55:37 -0400 Subject: [Rxtx] Closing a port from an event listener results in a deadlock Message-ID: <20050405175537.GA21747@rcog.homelinux.net> On the message I sent on March 14, does anyone had the chance to try the modification? Or was it already fixed? (I haven't searched the archive extensively) Or maybe my message got catched by some spam filters? (it made it to the list archive though) Anyway, I would appreciate some feedback (through the list) Thanks From taj at www.linux.org.uk Tue Apr 5 14:42:28 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 21:42:28 +0100 (BST) Subject: [Rxtx] Closing a port from an event listener results in a deadlock In-Reply-To: <20050405175537.GA21747@rcog.homelinux.net> References: <20050405175537.GA21747@rcog.homelinux.net> Message-ID: On Tue, 5 Apr 2005 no_spam at somewhere.com wrote: > On the message I sent on March 14, does anyone had the chance to try the > modification? > > Or was it already fixed? (I haven't searched the archive extensively) > > Or maybe my message got catched by some spam filters? (it made it to the list > archive though) > > Anyway, I would appreciate some feedback (through the list) > The patch is here http://marc.theaimsgroup.com/?l=rxtx&m=111084488820288&w=2 I have applied this patch to a local copy but will not be doing formal testing for a couple weeks. I do not try to close ports from inside the eventListenter usually so I encourage any feedback also. If there are no problems reported, I expect this will go into rxtx 2.1-7. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Wed Apr 6 08:33:42 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Wed, 06 Apr 2005 15:33:42 +0100 Subject: [Rxtx] getting RXTX version Message-ID: <4253F346.50102@emation.pt> Hi, I want to make sure my deployments have the same version of RXTX jar and native lib. I know the version of the jar can be obtained in the Version class, but how can I obtain the native version ? I know RXTX prints to the console a warning if the version is different. Is there a way to programatically know is this is the case ? I would like to log that to our app's log thanks Ricardo From taj at www.linux.org.uk Wed Apr 6 15:10:20 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 6 Apr 2005 22:10:20 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4253F346.50102@emation.pt> References: <4253F346.50102@emation.pt> Message-ID: On Wed, 6 Apr 2005, Ricardo Trindade wrote: > Hi, > > I want to make sure my deployments have the same version of RXTX jar > and native lib. > > I know the version of the jar can be obtained in the Version class, > but how can I obtain the native version ? > > I know RXTX prints to the console a warning if the version is > different. Is there a way to programatically know is this is the case ? > > I would like to log that to our app's log > There isn't a suggested way of doing that right now. We could move things around and have a static String RXTXVersion.getNativeVersion() in future releases. Is this what you expected? This is not documented in commapi at all. I just tossed that in to catch conflicts while developing. It would be nice to have access in GUI applications though. It may be possible to access RXTXCommDriver.LibVersion right now. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Thu Apr 7 02:51:00 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 09:51:00 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> Message-ID: <4254F474.7020905@emation.pt> >There isn't a suggested way of doing that right now. We could move things >around and have a static String RXTXVersion.getNativeVersion() in future >releases. Is this what you expected? > > Yes, that would be perfect. >This is not documented in commapi at all. I just tossed that in to catch >conflicts while developing. It would be nice to have access in GUI >applications though. > >It may be possible to access RXTXCommDriver.LibVersion right now. > > > I tried, and I don't think it's possible. From taj at www.linux.org.uk Thu Apr 7 03:32:04 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 7 Apr 2005 10:32:04 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4254F474.7020905@emation.pt> References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: On Thu, 7 Apr 2005, Ricardo Trindade wrote: > > >There isn't a suggested way of doing that right now. We could move things > >around and have a static String RXTXVersion.getNativeVersion() in future > >releases. Is this what you expected? > > > > > > Yes, that would be perfect. > The attached should do what you want. You will still need to catch an exception for older versions... -- Trent Jarvi taj at www.linux.org.uk -------------- next part -------------- ? public_version.patch Index: RXTXCommDriver.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXCommDriver.java,v retrieving revision 1.16.2.51 diff -u -r1.16.2.51 RXTXCommDriver.java --- RXTXCommDriver.java 12 Oct 2004 09:13:30 -0000 1.16.2.51 +++ RXTXCommDriver.java 7 Apr 2005 09:29:04 -0000 @@ -54,7 +54,7 @@ the Library. */ String JarVersion = RXTXVersion.getVersion(); - String LibVersion = nativeGetVersion(); + String LibVersion = RXTXVersion.nativeGetVersion(); if ( devel ) { System.out.println("Devel Library"); @@ -76,7 +76,6 @@ /** Get the Serial port prefixes for the running OS */ private String deviceDirectory; private String osName; - private static native String nativeGetVersion(); private native boolean registerKnownPorts(int PortType); private native boolean isPortPrefixValid(String dev); private native boolean testRead(String dev, int type); Index: RXTXVersion.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXVersion.java,v retrieving revision 1.2.2.31 diff -u -r1.2.2.31 RXTXVersion.java --- RXTXVersion.java 16 Oct 2004 16:20:35 -0000 1.2.2.31 +++ RXTXVersion.java 7 Apr 2005 09:29:04 -0000 @@ -36,6 +36,7 @@ private static String Version; static { + System.loadLibrary( "rxtxSerial" ); Version = "RXTX-2.1-7pre20"; } /** @@ -47,4 +48,5 @@ { return(Version); } + public static native String nativeGetVersion(); } Index: SerialImp.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v retrieving revision 1.46.2.181 diff -u -r1.46.2.181 SerialImp.c --- SerialImp.c 17 Oct 2004 09:48:56 -0000 1.46.2.181 +++ SerialImp.c 7 Apr 2005 09:29:07 -0000 @@ -116,6 +116,7 @@ * It will eventually be removed. * */ #define RXTXPort(foo) Java_gnu_io_RXTXPort_ ## foo +#define RXTXVersion(foo) Java_gnu_io_RXTXVersion_ ## foo #define RXTXCommDriver(foo) Java_gnu_io_RXTXCommDriver_ ## foo #if defined(__sun__) || defined(__hpux__) @@ -4001,7 +4002,7 @@ } /*---------------------------------------------------------- -RXTXCommDriver.nativeGetVersion +RXTXVersion.nativeGetVersion accept: none perform: return the current version @@ -4010,9 +4011,10 @@ comments: This is used to avoid mixing versions of the .jar and native library. First introduced in rxtx-1.5-9 + Moved from RXTXCommDriver to RXTXVersion in rxtx-2.1-7 ----------------------------------------------------------*/ -JNIEXPORT jstring JNICALL RXTXCommDriver(nativeGetVersion) (JNIEnv *env, +JNIEXPORT jstring JNICALL RXTXVersion(nativeGetVersion) (JNIEnv *env, jclass jclazz ) { return (*env)->NewStringUTF( env, "RXTX-2.1-7pre20" ); From ricardo.trindade at emation.pt Thu Apr 7 03:45:58 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 10:45:58 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: <42550156.2040908@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050407/05212451/attachment-0077.html From thomas.shulok at lmco.com Thu Apr 7 17:43:11 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Thu, 07 Apr 2005 19:43:11 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi There, I'm attempting to talk RS232 between an embedded Linux box and a Windows box. Everything connects up fine, and I can send and receive a simple sequence of bytes with no problems. However, if around 5 seconds goes by without me sending something, I get the following when I attempt to send. java.io.IOException: Input/output error in writeArray Stack trace: java/lang/Throwable.()V java/lang/Throwable.(Ljava/lang/String;)V java/io/IOException.(Ljava/lang/String;)V gnu/io/RXTXPort.writeArray([BIIZ)V gnu/io/RXTXPort$SerialOutputStream.write([B)V SerialTest.main([Ljava/lang/String;)V If there interval is shorter (say 2 seconds between sends), I have no problems. On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and librxtxSerial-2.0.7pre2.so. Any ideas? Thanks, Thom -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5b23dcf/attachment-0077.html From taj at www.linux.org.uk Thu Apr 7 19:22:36 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:22:36 +0100 (BST) Subject: [Rxtx] Input/output error in writeArray In-Reply-To: References: Message-ID: On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a Windows > box. Everything connects up fine, and I can send and receive a simple > sequence of bytes with no problems. However, if around 5 seconds goes > by without me sending something, I get the following when I attempt to > send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Apr 7 19:24:59 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:24:59 +0100 (BST) Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) Message-ID: hmm. This would not work from applets would it? -- Trent Jarvi taj at www.linux.org.uk ---------- Forwarded message ---------- Date: Thu, 07 Apr 2005 16:05:53 -0400 From: Chris Gaffney To: taj at www.linux.org.uk Subject: RXTX Libraries on Classpath fix Hi, I submitted a patch for RXTX a few weeks ago to allow for loading the native libraries from the classpath. Since sending it to you I found it wasn't working on windows. I've fixed the problem and created a new patch that should replace the older one. The actual change is a one line from a String.equals() to a String.startsWith(). Thanks for a great piece of software, -Chris Gaffney Grand Valley State University -------------- next part -------------- A non-text attachment was scrubbed... Name: libraries_on_classpath_fixed.patch Type: text/x-patch Size: 5617 bytes Desc: Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5d423b8/libraries_on_classpath_fixed-0077.bin From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From thomas.shulok at lmco.com Fri Apr 8 10:38:55 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Fri, 08 Apr 2005 12:38:55 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi Trent, Thanks for the prompt response. Before diving deeper, I was wondering if there is a timeout parameter somewhere in the stack that I have not set properly. Given the nature of the failure (only fails if the line has been idle for a few seconds), it feels like some kind of timeout issue... Thanks again, Thom -----Original Message----- From: rxtx-bounces at mail.linuxgrrls.org [mailto:rxtx-bounces at mail.linuxgrrls.org] On Behalf Of Trent Jarvi Sent: Thursday, April 07, 2005 6:23 PM To: Java RXTX discussion Subject: Re: [Rxtx] Input/output error in writeArray On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a > Windows box. Everything connects up fine, and I can send and receive > a simple sequence of bytes with no problems. However, if around 5 > seconds goes by without me sending something, I get the following when > I attempt to send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at mail.linuxgrrls.org http://mail.linuxgrrls.org/mailman/listinfo/rxtx From ricardo.trindade at emation.pt Mon Apr 4 09:17:23 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Mon, 04 Apr 2005 16:17:23 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot Message-ID: <42515A83.4050907@emation.pt> Hi, I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most recent stable snapshot), and get the following exception : It looks like rxtx has been compiled with jdk 1.5. If this was indeed the case, I think there is a compilation flag that generates code that runs on older jdks. java.lang.UnsupportedClassVersionError: gnu/io/UnsupportedCommOperationException (Unsupported major.minor version 49.0) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at java.net.URLClassLoader.defineClass(URLClassLoader.java:251) at java.net.URLClassLoader.access$100(URLClassLoader.java:55) at java.net.URLClassLoader$1.run(URLClassLoader.java:194) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:187) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:141) I'm trying to run it with 1.4. thanks Ricardo From taj at www.linux.org.uk Tue Apr 5 00:48:12 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 07:48:12 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42515A83.4050907@emation.pt> References: <42515A83.4050907@emation.pt> Message-ID: On Mon, 4 Apr 2005, Ricardo Trindade wrote: > Hi, > > I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most > recent stable snapshot), and get the following exception : > > It looks like rxtx has been compiled with jdk 1.5. If this was > indeed the case, I think there is a compilation flag that generates code > that runs on older jdks. > > java.lang.UnsupportedClassVersionError: > gnu/io/UnsupportedCommOperationException (Unsupported major.minor > version 49.0) [snip] Thanks Ricardo I recompiled the jar with javac -source 1.3 -target 1.3. That should cover most of the JRE's in use today. I also compiled the rxtx 2.0 x86_64 native library which appeared to be missing. I tried looking for flags to pass gcc 4.0 to make the native libraries more backwards compatible but only found options for C++ which is not used in rxtx. I've got a list of other bugs that I'll be going through in the next few weeks but for now I just left them with the same CVS filename - no code changes. ftp://ftp.qbang.org/pub/rxtx/rxtx-2.0-CVS-20050120-bins.tar.gz ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-CVS-20050120-bins.tar.gz -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Tue Apr 5 02:24:33 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 05 Apr 2005 09:24:33 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: References: <42515A83.4050907@emation.pt> Message-ID: <42524B41.3040300@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050405/5919abbb/attachment-0078.html From taj at www.linux.org.uk Tue Apr 5 03:00:29 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 10:00:29 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42524B41.3040300@emation.pt> References: <42515A83.4050907@emation.pt> <42524B41.3040300@emation.pt> Message-ID: On Tue, 5 Apr 2005, Ricardo Trindade wrote: > Will you anounce to the list when a new release is available ? > There will be several incremental releases announced here. Once those are done, we will release 2.1.7 and 2.0.7. -- Trent Jarvi taj at www.linux.org.uk From no_spam at somewhere.com Tue Apr 5 11:55:37 2005 From: no_spam at somewhere.com (no_spam@somewhere.com) Date: Tue, 5 Apr 2005 13:55:37 -0400 Subject: [Rxtx] Closing a port from an event listener results in a deadlock Message-ID: <20050405175537.GA21747@rcog.homelinux.net> On the message I sent on March 14, does anyone had the chance to try the modification? Or was it already fixed? (I haven't searched the archive extensively) Or maybe my message got catched by some spam filters? (it made it to the list archive though) Anyway, I would appreciate some feedback (through the list) Thanks From taj at www.linux.org.uk Tue Apr 5 14:42:28 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 21:42:28 +0100 (BST) Subject: [Rxtx] Closing a port from an event listener results in a deadlock In-Reply-To: <20050405175537.GA21747@rcog.homelinux.net> References: <20050405175537.GA21747@rcog.homelinux.net> Message-ID: On Tue, 5 Apr 2005 no_spam at somewhere.com wrote: > On the message I sent on March 14, does anyone had the chance to try the > modification? > > Or was it already fixed? (I haven't searched the archive extensively) > > Or maybe my message got catched by some spam filters? (it made it to the list > archive though) > > Anyway, I would appreciate some feedback (through the list) > The patch is here http://marc.theaimsgroup.com/?l=rxtx&m=111084488820288&w=2 I have applied this patch to a local copy but will not be doing formal testing for a couple weeks. I do not try to close ports from inside the eventListenter usually so I encourage any feedback also. If there are no problems reported, I expect this will go into rxtx 2.1-7. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Wed Apr 6 08:33:42 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Wed, 06 Apr 2005 15:33:42 +0100 Subject: [Rxtx] getting RXTX version Message-ID: <4253F346.50102@emation.pt> Hi, I want to make sure my deployments have the same version of RXTX jar and native lib. I know the version of the jar can be obtained in the Version class, but how can I obtain the native version ? I know RXTX prints to the console a warning if the version is different. Is there a way to programatically know is this is the case ? I would like to log that to our app's log thanks Ricardo From taj at www.linux.org.uk Wed Apr 6 15:10:20 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 6 Apr 2005 22:10:20 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4253F346.50102@emation.pt> References: <4253F346.50102@emation.pt> Message-ID: On Wed, 6 Apr 2005, Ricardo Trindade wrote: > Hi, > > I want to make sure my deployments have the same version of RXTX jar > and native lib. > > I know the version of the jar can be obtained in the Version class, > but how can I obtain the native version ? > > I know RXTX prints to the console a warning if the version is > different. Is there a way to programatically know is this is the case ? > > I would like to log that to our app's log > There isn't a suggested way of doing that right now. We could move things around and have a static String RXTXVersion.getNativeVersion() in future releases. Is this what you expected? This is not documented in commapi at all. I just tossed that in to catch conflicts while developing. It would be nice to have access in GUI applications though. It may be possible to access RXTXCommDriver.LibVersion right now. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Thu Apr 7 02:51:00 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 09:51:00 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> Message-ID: <4254F474.7020905@emation.pt> >There isn't a suggested way of doing that right now. We could move things >around and have a static String RXTXVersion.getNativeVersion() in future >releases. Is this what you expected? > > Yes, that would be perfect. >This is not documented in commapi at all. I just tossed that in to catch >conflicts while developing. It would be nice to have access in GUI >applications though. > >It may be possible to access RXTXCommDriver.LibVersion right now. > > > I tried, and I don't think it's possible. From taj at www.linux.org.uk Thu Apr 7 03:32:04 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 7 Apr 2005 10:32:04 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4254F474.7020905@emation.pt> References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: On Thu, 7 Apr 2005, Ricardo Trindade wrote: > > >There isn't a suggested way of doing that right now. We could move things > >around and have a static String RXTXVersion.getNativeVersion() in future > >releases. Is this what you expected? > > > > > > Yes, that would be perfect. > The attached should do what you want. You will still need to catch an exception for older versions... -- Trent Jarvi taj at www.linux.org.uk -------------- next part -------------- ? public_version.patch Index: RXTXCommDriver.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXCommDriver.java,v retrieving revision 1.16.2.51 diff -u -r1.16.2.51 RXTXCommDriver.java --- RXTXCommDriver.java 12 Oct 2004 09:13:30 -0000 1.16.2.51 +++ RXTXCommDriver.java 7 Apr 2005 09:29:04 -0000 @@ -54,7 +54,7 @@ the Library. */ String JarVersion = RXTXVersion.getVersion(); - String LibVersion = nativeGetVersion(); + String LibVersion = RXTXVersion.nativeGetVersion(); if ( devel ) { System.out.println("Devel Library"); @@ -76,7 +76,6 @@ /** Get the Serial port prefixes for the running OS */ private String deviceDirectory; private String osName; - private static native String nativeGetVersion(); private native boolean registerKnownPorts(int PortType); private native boolean isPortPrefixValid(String dev); private native boolean testRead(String dev, int type); Index: RXTXVersion.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXVersion.java,v retrieving revision 1.2.2.31 diff -u -r1.2.2.31 RXTXVersion.java --- RXTXVersion.java 16 Oct 2004 16:20:35 -0000 1.2.2.31 +++ RXTXVersion.java 7 Apr 2005 09:29:04 -0000 @@ -36,6 +36,7 @@ private static String Version; static { + System.loadLibrary( "rxtxSerial" ); Version = "RXTX-2.1-7pre20"; } /** @@ -47,4 +48,5 @@ { return(Version); } + public static native String nativeGetVersion(); } Index: SerialImp.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v retrieving revision 1.46.2.181 diff -u -r1.46.2.181 SerialImp.c --- SerialImp.c 17 Oct 2004 09:48:56 -0000 1.46.2.181 +++ SerialImp.c 7 Apr 2005 09:29:07 -0000 @@ -116,6 +116,7 @@ * It will eventually be removed. * */ #define RXTXPort(foo) Java_gnu_io_RXTXPort_ ## foo +#define RXTXVersion(foo) Java_gnu_io_RXTXVersion_ ## foo #define RXTXCommDriver(foo) Java_gnu_io_RXTXCommDriver_ ## foo #if defined(__sun__) || defined(__hpux__) @@ -4001,7 +4002,7 @@ } /*---------------------------------------------------------- -RXTXCommDriver.nativeGetVersion +RXTXVersion.nativeGetVersion accept: none perform: return the current version @@ -4010,9 +4011,10 @@ comments: This is used to avoid mixing versions of the .jar and native library. First introduced in rxtx-1.5-9 + Moved from RXTXCommDriver to RXTXVersion in rxtx-2.1-7 ----------------------------------------------------------*/ -JNIEXPORT jstring JNICALL RXTXCommDriver(nativeGetVersion) (JNIEnv *env, +JNIEXPORT jstring JNICALL RXTXVersion(nativeGetVersion) (JNIEnv *env, jclass jclazz ) { return (*env)->NewStringUTF( env, "RXTX-2.1-7pre20" ); From ricardo.trindade at emation.pt Thu Apr 7 03:45:58 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 10:45:58 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: <42550156.2040908@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050407/05212451/attachment-0078.html From thomas.shulok at lmco.com Thu Apr 7 17:43:11 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Thu, 07 Apr 2005 19:43:11 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi There, I'm attempting to talk RS232 between an embedded Linux box and a Windows box. Everything connects up fine, and I can send and receive a simple sequence of bytes with no problems. However, if around 5 seconds goes by without me sending something, I get the following when I attempt to send. java.io.IOException: Input/output error in writeArray Stack trace: java/lang/Throwable.()V java/lang/Throwable.(Ljava/lang/String;)V java/io/IOException.(Ljava/lang/String;)V gnu/io/RXTXPort.writeArray([BIIZ)V gnu/io/RXTXPort$SerialOutputStream.write([B)V SerialTest.main([Ljava/lang/String;)V If there interval is shorter (say 2 seconds between sends), I have no problems. On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and librxtxSerial-2.0.7pre2.so. Any ideas? Thanks, Thom -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5b23dcf/attachment-0078.html From taj at www.linux.org.uk Thu Apr 7 19:22:36 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:22:36 +0100 (BST) Subject: [Rxtx] Input/output error in writeArray In-Reply-To: References: Message-ID: On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a Windows > box. Everything connects up fine, and I can send and receive a simple > sequence of bytes with no problems. However, if around 5 seconds goes > by without me sending something, I get the following when I attempt to > send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Apr 7 19:24:59 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:24:59 +0100 (BST) Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) Message-ID: hmm. This would not work from applets would it? -- Trent Jarvi taj at www.linux.org.uk ---------- Forwarded message ---------- Date: Thu, 07 Apr 2005 16:05:53 -0400 From: Chris Gaffney To: taj at www.linux.org.uk Subject: RXTX Libraries on Classpath fix Hi, I submitted a patch for RXTX a few weeks ago to allow for loading the native libraries from the classpath. Since sending it to you I found it wasn't working on windows. I've fixed the problem and created a new patch that should replace the older one. The actual change is a one line from a String.equals() to a String.startsWith(). Thanks for a great piece of software, -Chris Gaffney Grand Valley State University -------------- next part -------------- A non-text attachment was scrubbed... Name: libraries_on_classpath_fixed.patch Type: text/x-patch Size: 5617 bytes Desc: Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5d423b8/libraries_on_classpath_fixed-0078.bin From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From thomas.shulok at lmco.com Fri Apr 8 10:38:55 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Fri, 08 Apr 2005 12:38:55 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi Trent, Thanks for the prompt response. Before diving deeper, I was wondering if there is a timeout parameter somewhere in the stack that I have not set properly. Given the nature of the failure (only fails if the line has been idle for a few seconds), it feels like some kind of timeout issue... Thanks again, Thom -----Original Message----- From: rxtx-bounces at mail.linuxgrrls.org [mailto:rxtx-bounces at mail.linuxgrrls.org] On Behalf Of Trent Jarvi Sent: Thursday, April 07, 2005 6:23 PM To: Java RXTX discussion Subject: Re: [Rxtx] Input/output error in writeArray On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a > Windows box. Everything connects up fine, and I can send and receive > a simple sequence of bytes with no problems. However, if around 5 > seconds goes by without me sending something, I get the following when > I attempt to send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at mail.linuxgrrls.org http://mail.linuxgrrls.org/mailman/listinfo/rxtx From ricardo.trindade at emation.pt Mon Apr 4 09:17:23 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Mon, 04 Apr 2005 16:17:23 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot Message-ID: <42515A83.4050907@emation.pt> Hi, I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most recent stable snapshot), and get the following exception : It looks like rxtx has been compiled with jdk 1.5. If this was indeed the case, I think there is a compilation flag that generates code that runs on older jdks. java.lang.UnsupportedClassVersionError: gnu/io/UnsupportedCommOperationException (Unsupported major.minor version 49.0) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at java.net.URLClassLoader.defineClass(URLClassLoader.java:251) at java.net.URLClassLoader.access$100(URLClassLoader.java:55) at java.net.URLClassLoader$1.run(URLClassLoader.java:194) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:187) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:141) I'm trying to run it with 1.4. thanks Ricardo From taj at www.linux.org.uk Tue Apr 5 00:48:12 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 07:48:12 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42515A83.4050907@emation.pt> References: <42515A83.4050907@emation.pt> Message-ID: On Mon, 4 Apr 2005, Ricardo Trindade wrote: > Hi, > > I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most > recent stable snapshot), and get the following exception : > > It looks like rxtx has been compiled with jdk 1.5. If this was > indeed the case, I think there is a compilation flag that generates code > that runs on older jdks. > > java.lang.UnsupportedClassVersionError: > gnu/io/UnsupportedCommOperationException (Unsupported major.minor > version 49.0) [snip] Thanks Ricardo I recompiled the jar with javac -source 1.3 -target 1.3. That should cover most of the JRE's in use today. I also compiled the rxtx 2.0 x86_64 native library which appeared to be missing. I tried looking for flags to pass gcc 4.0 to make the native libraries more backwards compatible but only found options for C++ which is not used in rxtx. I've got a list of other bugs that I'll be going through in the next few weeks but for now I just left them with the same CVS filename - no code changes. ftp://ftp.qbang.org/pub/rxtx/rxtx-2.0-CVS-20050120-bins.tar.gz ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-CVS-20050120-bins.tar.gz -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Tue Apr 5 02:24:33 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 05 Apr 2005 09:24:33 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: References: <42515A83.4050907@emation.pt> Message-ID: <42524B41.3040300@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050405/5919abbb/attachment-0079.html From taj at www.linux.org.uk Tue Apr 5 03:00:29 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 10:00:29 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42524B41.3040300@emation.pt> References: <42515A83.4050907@emation.pt> <42524B41.3040300@emation.pt> Message-ID: On Tue, 5 Apr 2005, Ricardo Trindade wrote: > Will you anounce to the list when a new release is available ? > There will be several incremental releases announced here. Once those are done, we will release 2.1.7 and 2.0.7. -- Trent Jarvi taj at www.linux.org.uk From no_spam at somewhere.com Tue Apr 5 11:55:37 2005 From: no_spam at somewhere.com (no_spam@somewhere.com) Date: Tue, 5 Apr 2005 13:55:37 -0400 Subject: [Rxtx] Closing a port from an event listener results in a deadlock Message-ID: <20050405175537.GA21747@rcog.homelinux.net> On the message I sent on March 14, does anyone had the chance to try the modification? Or was it already fixed? (I haven't searched the archive extensively) Or maybe my message got catched by some spam filters? (it made it to the list archive though) Anyway, I would appreciate some feedback (through the list) Thanks From taj at www.linux.org.uk Tue Apr 5 14:42:28 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 21:42:28 +0100 (BST) Subject: [Rxtx] Closing a port from an event listener results in a deadlock In-Reply-To: <20050405175537.GA21747@rcog.homelinux.net> References: <20050405175537.GA21747@rcog.homelinux.net> Message-ID: On Tue, 5 Apr 2005 no_spam at somewhere.com wrote: > On the message I sent on March 14, does anyone had the chance to try the > modification? > > Or was it already fixed? (I haven't searched the archive extensively) > > Or maybe my message got catched by some spam filters? (it made it to the list > archive though) > > Anyway, I would appreciate some feedback (through the list) > The patch is here http://marc.theaimsgroup.com/?l=rxtx&m=111084488820288&w=2 I have applied this patch to a local copy but will not be doing formal testing for a couple weeks. I do not try to close ports from inside the eventListenter usually so I encourage any feedback also. If there are no problems reported, I expect this will go into rxtx 2.1-7. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Wed Apr 6 08:33:42 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Wed, 06 Apr 2005 15:33:42 +0100 Subject: [Rxtx] getting RXTX version Message-ID: <4253F346.50102@emation.pt> Hi, I want to make sure my deployments have the same version of RXTX jar and native lib. I know the version of the jar can be obtained in the Version class, but how can I obtain the native version ? I know RXTX prints to the console a warning if the version is different. Is there a way to programatically know is this is the case ? I would like to log that to our app's log thanks Ricardo From taj at www.linux.org.uk Wed Apr 6 15:10:20 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 6 Apr 2005 22:10:20 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4253F346.50102@emation.pt> References: <4253F346.50102@emation.pt> Message-ID: On Wed, 6 Apr 2005, Ricardo Trindade wrote: > Hi, > > I want to make sure my deployments have the same version of RXTX jar > and native lib. > > I know the version of the jar can be obtained in the Version class, > but how can I obtain the native version ? > > I know RXTX prints to the console a warning if the version is > different. Is there a way to programatically know is this is the case ? > > I would like to log that to our app's log > There isn't a suggested way of doing that right now. We could move things around and have a static String RXTXVersion.getNativeVersion() in future releases. Is this what you expected? This is not documented in commapi at all. I just tossed that in to catch conflicts while developing. It would be nice to have access in GUI applications though. It may be possible to access RXTXCommDriver.LibVersion right now. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Thu Apr 7 02:51:00 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 09:51:00 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> Message-ID: <4254F474.7020905@emation.pt> >There isn't a suggested way of doing that right now. We could move things >around and have a static String RXTXVersion.getNativeVersion() in future >releases. Is this what you expected? > > Yes, that would be perfect. >This is not documented in commapi at all. I just tossed that in to catch >conflicts while developing. It would be nice to have access in GUI >applications though. > >It may be possible to access RXTXCommDriver.LibVersion right now. > > > I tried, and I don't think it's possible. From taj at www.linux.org.uk Thu Apr 7 03:32:04 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 7 Apr 2005 10:32:04 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4254F474.7020905@emation.pt> References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: On Thu, 7 Apr 2005, Ricardo Trindade wrote: > > >There isn't a suggested way of doing that right now. We could move things > >around and have a static String RXTXVersion.getNativeVersion() in future > >releases. Is this what you expected? > > > > > > Yes, that would be perfect. > The attached should do what you want. You will still need to catch an exception for older versions... -- Trent Jarvi taj at www.linux.org.uk -------------- next part -------------- ? public_version.patch Index: RXTXCommDriver.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXCommDriver.java,v retrieving revision 1.16.2.51 diff -u -r1.16.2.51 RXTXCommDriver.java --- RXTXCommDriver.java 12 Oct 2004 09:13:30 -0000 1.16.2.51 +++ RXTXCommDriver.java 7 Apr 2005 09:29:04 -0000 @@ -54,7 +54,7 @@ the Library. */ String JarVersion = RXTXVersion.getVersion(); - String LibVersion = nativeGetVersion(); + String LibVersion = RXTXVersion.nativeGetVersion(); if ( devel ) { System.out.println("Devel Library"); @@ -76,7 +76,6 @@ /** Get the Serial port prefixes for the running OS */ private String deviceDirectory; private String osName; - private static native String nativeGetVersion(); private native boolean registerKnownPorts(int PortType); private native boolean isPortPrefixValid(String dev); private native boolean testRead(String dev, int type); Index: RXTXVersion.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXVersion.java,v retrieving revision 1.2.2.31 diff -u -r1.2.2.31 RXTXVersion.java --- RXTXVersion.java 16 Oct 2004 16:20:35 -0000 1.2.2.31 +++ RXTXVersion.java 7 Apr 2005 09:29:04 -0000 @@ -36,6 +36,7 @@ private static String Version; static { + System.loadLibrary( "rxtxSerial" ); Version = "RXTX-2.1-7pre20"; } /** @@ -47,4 +48,5 @@ { return(Version); } + public static native String nativeGetVersion(); } Index: SerialImp.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v retrieving revision 1.46.2.181 diff -u -r1.46.2.181 SerialImp.c --- SerialImp.c 17 Oct 2004 09:48:56 -0000 1.46.2.181 +++ SerialImp.c 7 Apr 2005 09:29:07 -0000 @@ -116,6 +116,7 @@ * It will eventually be removed. * */ #define RXTXPort(foo) Java_gnu_io_RXTXPort_ ## foo +#define RXTXVersion(foo) Java_gnu_io_RXTXVersion_ ## foo #define RXTXCommDriver(foo) Java_gnu_io_RXTXCommDriver_ ## foo #if defined(__sun__) || defined(__hpux__) @@ -4001,7 +4002,7 @@ } /*---------------------------------------------------------- -RXTXCommDriver.nativeGetVersion +RXTXVersion.nativeGetVersion accept: none perform: return the current version @@ -4010,9 +4011,10 @@ comments: This is used to avoid mixing versions of the .jar and native library. First introduced in rxtx-1.5-9 + Moved from RXTXCommDriver to RXTXVersion in rxtx-2.1-7 ----------------------------------------------------------*/ -JNIEXPORT jstring JNICALL RXTXCommDriver(nativeGetVersion) (JNIEnv *env, +JNIEXPORT jstring JNICALL RXTXVersion(nativeGetVersion) (JNIEnv *env, jclass jclazz ) { return (*env)->NewStringUTF( env, "RXTX-2.1-7pre20" ); From ricardo.trindade at emation.pt Thu Apr 7 03:45:58 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 10:45:58 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: <42550156.2040908@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050407/05212451/attachment-0079.html From thomas.shulok at lmco.com Thu Apr 7 17:43:11 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Thu, 07 Apr 2005 19:43:11 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi There, I'm attempting to talk RS232 between an embedded Linux box and a Windows box. Everything connects up fine, and I can send and receive a simple sequence of bytes with no problems. However, if around 5 seconds goes by without me sending something, I get the following when I attempt to send. java.io.IOException: Input/output error in writeArray Stack trace: java/lang/Throwable.()V java/lang/Throwable.(Ljava/lang/String;)V java/io/IOException.(Ljava/lang/String;)V gnu/io/RXTXPort.writeArray([BIIZ)V gnu/io/RXTXPort$SerialOutputStream.write([B)V SerialTest.main([Ljava/lang/String;)V If there interval is shorter (say 2 seconds between sends), I have no problems. On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and librxtxSerial-2.0.7pre2.so. Any ideas? Thanks, Thom -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5b23dcf/attachment-0079.html From taj at www.linux.org.uk Thu Apr 7 19:22:36 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:22:36 +0100 (BST) Subject: [Rxtx] Input/output error in writeArray In-Reply-To: References: Message-ID: On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a Windows > box. Everything connects up fine, and I can send and receive a simple > sequence of bytes with no problems. However, if around 5 seconds goes > by without me sending something, I get the following when I attempt to > send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Apr 7 19:24:59 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:24:59 +0100 (BST) Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) Message-ID: hmm. This would not work from applets would it? -- Trent Jarvi taj at www.linux.org.uk ---------- Forwarded message ---------- Date: Thu, 07 Apr 2005 16:05:53 -0400 From: Chris Gaffney To: taj at www.linux.org.uk Subject: RXTX Libraries on Classpath fix Hi, I submitted a patch for RXTX a few weeks ago to allow for loading the native libraries from the classpath. Since sending it to you I found it wasn't working on windows. I've fixed the problem and created a new patch that should replace the older one. The actual change is a one line from a String.equals() to a String.startsWith(). Thanks for a great piece of software, -Chris Gaffney Grand Valley State University -------------- next part -------------- A non-text attachment was scrubbed... Name: libraries_on_classpath_fixed.patch Type: text/x-patch Size: 5617 bytes Desc: Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5d423b8/libraries_on_classpath_fixed-0079.bin From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From thomas.shulok at lmco.com Fri Apr 8 10:38:55 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Fri, 08 Apr 2005 12:38:55 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi Trent, Thanks for the prompt response. Before diving deeper, I was wondering if there is a timeout parameter somewhere in the stack that I have not set properly. Given the nature of the failure (only fails if the line has been idle for a few seconds), it feels like some kind of timeout issue... Thanks again, Thom -----Original Message----- From: rxtx-bounces at mail.linuxgrrls.org [mailto:rxtx-bounces at mail.linuxgrrls.org] On Behalf Of Trent Jarvi Sent: Thursday, April 07, 2005 6:23 PM To: Java RXTX discussion Subject: Re: [Rxtx] Input/output error in writeArray On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a > Windows box. Everything connects up fine, and I can send and receive > a simple sequence of bytes with no problems. However, if around 5 > seconds goes by without me sending something, I get the following when > I attempt to send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at mail.linuxgrrls.org http://mail.linuxgrrls.org/mailman/listinfo/rxtx From ricardo.trindade at emation.pt Mon Apr 4 09:17:23 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Mon, 04 Apr 2005 16:17:23 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot Message-ID: <42515A83.4050907@emation.pt> Hi, I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most recent stable snapshot), and get the following exception : It looks like rxtx has been compiled with jdk 1.5. If this was indeed the case, I think there is a compilation flag that generates code that runs on older jdks. java.lang.UnsupportedClassVersionError: gnu/io/UnsupportedCommOperationException (Unsupported major.minor version 49.0) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at java.net.URLClassLoader.defineClass(URLClassLoader.java:251) at java.net.URLClassLoader.access$100(URLClassLoader.java:55) at java.net.URLClassLoader$1.run(URLClassLoader.java:194) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:187) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:141) I'm trying to run it with 1.4. thanks Ricardo From taj at www.linux.org.uk Tue Apr 5 00:48:12 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 07:48:12 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42515A83.4050907@emation.pt> References: <42515A83.4050907@emation.pt> Message-ID: On Mon, 4 Apr 2005, Ricardo Trindade wrote: > Hi, > > I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most > recent stable snapshot), and get the following exception : > > It looks like rxtx has been compiled with jdk 1.5. If this was > indeed the case, I think there is a compilation flag that generates code > that runs on older jdks. > > java.lang.UnsupportedClassVersionError: > gnu/io/UnsupportedCommOperationException (Unsupported major.minor > version 49.0) [snip] Thanks Ricardo I recompiled the jar with javac -source 1.3 -target 1.3. That should cover most of the JRE's in use today. I also compiled the rxtx 2.0 x86_64 native library which appeared to be missing. I tried looking for flags to pass gcc 4.0 to make the native libraries more backwards compatible but only found options for C++ which is not used in rxtx. I've got a list of other bugs that I'll be going through in the next few weeks but for now I just left them with the same CVS filename - no code changes. ftp://ftp.qbang.org/pub/rxtx/rxtx-2.0-CVS-20050120-bins.tar.gz ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-CVS-20050120-bins.tar.gz -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Tue Apr 5 02:24:33 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 05 Apr 2005 09:24:33 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: References: <42515A83.4050907@emation.pt> Message-ID: <42524B41.3040300@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050405/5919abbb/attachment-0080.html From taj at www.linux.org.uk Tue Apr 5 03:00:29 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 10:00:29 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42524B41.3040300@emation.pt> References: <42515A83.4050907@emation.pt> <42524B41.3040300@emation.pt> Message-ID: On Tue, 5 Apr 2005, Ricardo Trindade wrote: > Will you anounce to the list when a new release is available ? > There will be several incremental releases announced here. Once those are done, we will release 2.1.7 and 2.0.7. -- Trent Jarvi taj at www.linux.org.uk From no_spam at somewhere.com Tue Apr 5 11:55:37 2005 From: no_spam at somewhere.com (no_spam@somewhere.com) Date: Tue, 5 Apr 2005 13:55:37 -0400 Subject: [Rxtx] Closing a port from an event listener results in a deadlock Message-ID: <20050405175537.GA21747@rcog.homelinux.net> On the message I sent on March 14, does anyone had the chance to try the modification? Or was it already fixed? (I haven't searched the archive extensively) Or maybe my message got catched by some spam filters? (it made it to the list archive though) Anyway, I would appreciate some feedback (through the list) Thanks From taj at www.linux.org.uk Tue Apr 5 14:42:28 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 21:42:28 +0100 (BST) Subject: [Rxtx] Closing a port from an event listener results in a deadlock In-Reply-To: <20050405175537.GA21747@rcog.homelinux.net> References: <20050405175537.GA21747@rcog.homelinux.net> Message-ID: On Tue, 5 Apr 2005 no_spam at somewhere.com wrote: > On the message I sent on March 14, does anyone had the chance to try the > modification? > > Or was it already fixed? (I haven't searched the archive extensively) > > Or maybe my message got catched by some spam filters? (it made it to the list > archive though) > > Anyway, I would appreciate some feedback (through the list) > The patch is here http://marc.theaimsgroup.com/?l=rxtx&m=111084488820288&w=2 I have applied this patch to a local copy but will not be doing formal testing for a couple weeks. I do not try to close ports from inside the eventListenter usually so I encourage any feedback also. If there are no problems reported, I expect this will go into rxtx 2.1-7. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Wed Apr 6 08:33:42 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Wed, 06 Apr 2005 15:33:42 +0100 Subject: [Rxtx] getting RXTX version Message-ID: <4253F346.50102@emation.pt> Hi, I want to make sure my deployments have the same version of RXTX jar and native lib. I know the version of the jar can be obtained in the Version class, but how can I obtain the native version ? I know RXTX prints to the console a warning if the version is different. Is there a way to programatically know is this is the case ? I would like to log that to our app's log thanks Ricardo From taj at www.linux.org.uk Wed Apr 6 15:10:20 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 6 Apr 2005 22:10:20 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4253F346.50102@emation.pt> References: <4253F346.50102@emation.pt> Message-ID: On Wed, 6 Apr 2005, Ricardo Trindade wrote: > Hi, > > I want to make sure my deployments have the same version of RXTX jar > and native lib. > > I know the version of the jar can be obtained in the Version class, > but how can I obtain the native version ? > > I know RXTX prints to the console a warning if the version is > different. Is there a way to programatically know is this is the case ? > > I would like to log that to our app's log > There isn't a suggested way of doing that right now. We could move things around and have a static String RXTXVersion.getNativeVersion() in future releases. Is this what you expected? This is not documented in commapi at all. I just tossed that in to catch conflicts while developing. It would be nice to have access in GUI applications though. It may be possible to access RXTXCommDriver.LibVersion right now. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Thu Apr 7 02:51:00 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 09:51:00 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> Message-ID: <4254F474.7020905@emation.pt> >There isn't a suggested way of doing that right now. We could move things >around and have a static String RXTXVersion.getNativeVersion() in future >releases. Is this what you expected? > > Yes, that would be perfect. >This is not documented in commapi at all. I just tossed that in to catch >conflicts while developing. It would be nice to have access in GUI >applications though. > >It may be possible to access RXTXCommDriver.LibVersion right now. > > > I tried, and I don't think it's possible. From taj at www.linux.org.uk Thu Apr 7 03:32:04 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 7 Apr 2005 10:32:04 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4254F474.7020905@emation.pt> References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: On Thu, 7 Apr 2005, Ricardo Trindade wrote: > > >There isn't a suggested way of doing that right now. We could move things > >around and have a static String RXTXVersion.getNativeVersion() in future > >releases. Is this what you expected? > > > > > > Yes, that would be perfect. > The attached should do what you want. You will still need to catch an exception for older versions... -- Trent Jarvi taj at www.linux.org.uk -------------- next part -------------- ? public_version.patch Index: RXTXCommDriver.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXCommDriver.java,v retrieving revision 1.16.2.51 diff -u -r1.16.2.51 RXTXCommDriver.java --- RXTXCommDriver.java 12 Oct 2004 09:13:30 -0000 1.16.2.51 +++ RXTXCommDriver.java 7 Apr 2005 09:29:04 -0000 @@ -54,7 +54,7 @@ the Library. */ String JarVersion = RXTXVersion.getVersion(); - String LibVersion = nativeGetVersion(); + String LibVersion = RXTXVersion.nativeGetVersion(); if ( devel ) { System.out.println("Devel Library"); @@ -76,7 +76,6 @@ /** Get the Serial port prefixes for the running OS */ private String deviceDirectory; private String osName; - private static native String nativeGetVersion(); private native boolean registerKnownPorts(int PortType); private native boolean isPortPrefixValid(String dev); private native boolean testRead(String dev, int type); Index: RXTXVersion.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXVersion.java,v retrieving revision 1.2.2.31 diff -u -r1.2.2.31 RXTXVersion.java --- RXTXVersion.java 16 Oct 2004 16:20:35 -0000 1.2.2.31 +++ RXTXVersion.java 7 Apr 2005 09:29:04 -0000 @@ -36,6 +36,7 @@ private static String Version; static { + System.loadLibrary( "rxtxSerial" ); Version = "RXTX-2.1-7pre20"; } /** @@ -47,4 +48,5 @@ { return(Version); } + public static native String nativeGetVersion(); } Index: SerialImp.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v retrieving revision 1.46.2.181 diff -u -r1.46.2.181 SerialImp.c --- SerialImp.c 17 Oct 2004 09:48:56 -0000 1.46.2.181 +++ SerialImp.c 7 Apr 2005 09:29:07 -0000 @@ -116,6 +116,7 @@ * It will eventually be removed. * */ #define RXTXPort(foo) Java_gnu_io_RXTXPort_ ## foo +#define RXTXVersion(foo) Java_gnu_io_RXTXVersion_ ## foo #define RXTXCommDriver(foo) Java_gnu_io_RXTXCommDriver_ ## foo #if defined(__sun__) || defined(__hpux__) @@ -4001,7 +4002,7 @@ } /*---------------------------------------------------------- -RXTXCommDriver.nativeGetVersion +RXTXVersion.nativeGetVersion accept: none perform: return the current version @@ -4010,9 +4011,10 @@ comments: This is used to avoid mixing versions of the .jar and native library. First introduced in rxtx-1.5-9 + Moved from RXTXCommDriver to RXTXVersion in rxtx-2.1-7 ----------------------------------------------------------*/ -JNIEXPORT jstring JNICALL RXTXCommDriver(nativeGetVersion) (JNIEnv *env, +JNIEXPORT jstring JNICALL RXTXVersion(nativeGetVersion) (JNIEnv *env, jclass jclazz ) { return (*env)->NewStringUTF( env, "RXTX-2.1-7pre20" ); From ricardo.trindade at emation.pt Thu Apr 7 03:45:58 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 10:45:58 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: <42550156.2040908@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050407/05212451/attachment-0080.html From thomas.shulok at lmco.com Thu Apr 7 17:43:11 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Thu, 07 Apr 2005 19:43:11 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi There, I'm attempting to talk RS232 between an embedded Linux box and a Windows box. Everything connects up fine, and I can send and receive a simple sequence of bytes with no problems. However, if around 5 seconds goes by without me sending something, I get the following when I attempt to send. java.io.IOException: Input/output error in writeArray Stack trace: java/lang/Throwable.()V java/lang/Throwable.(Ljava/lang/String;)V java/io/IOException.(Ljava/lang/String;)V gnu/io/RXTXPort.writeArray([BIIZ)V gnu/io/RXTXPort$SerialOutputStream.write([B)V SerialTest.main([Ljava/lang/String;)V If there interval is shorter (say 2 seconds between sends), I have no problems. On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and librxtxSerial-2.0.7pre2.so. Any ideas? Thanks, Thom -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5b23dcf/attachment-0080.html From taj at www.linux.org.uk Thu Apr 7 19:22:36 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:22:36 +0100 (BST) Subject: [Rxtx] Input/output error in writeArray In-Reply-To: References: Message-ID: On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a Windows > box. Everything connects up fine, and I can send and receive a simple > sequence of bytes with no problems. However, if around 5 seconds goes > by without me sending something, I get the following when I attempt to > send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Apr 7 19:24:59 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:24:59 +0100 (BST) Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) Message-ID: hmm. This would not work from applets would it? -- Trent Jarvi taj at www.linux.org.uk ---------- Forwarded message ---------- Date: Thu, 07 Apr 2005 16:05:53 -0400 From: Chris Gaffney To: taj at www.linux.org.uk Subject: RXTX Libraries on Classpath fix Hi, I submitted a patch for RXTX a few weeks ago to allow for loading the native libraries from the classpath. Since sending it to you I found it wasn't working on windows. I've fixed the problem and created a new patch that should replace the older one. The actual change is a one line from a String.equals() to a String.startsWith(). Thanks for a great piece of software, -Chris Gaffney Grand Valley State University -------------- next part -------------- A non-text attachment was scrubbed... Name: libraries_on_classpath_fixed.patch Type: text/x-patch Size: 5617 bytes Desc: Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5d423b8/libraries_on_classpath_fixed-0080.bin From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From thomas.shulok at lmco.com Fri Apr 8 10:38:55 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Fri, 08 Apr 2005 12:38:55 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi Trent, Thanks for the prompt response. Before diving deeper, I was wondering if there is a timeout parameter somewhere in the stack that I have not set properly. Given the nature of the failure (only fails if the line has been idle for a few seconds), it feels like some kind of timeout issue... Thanks again, Thom -----Original Message----- From: rxtx-bounces at mail.linuxgrrls.org [mailto:rxtx-bounces at mail.linuxgrrls.org] On Behalf Of Trent Jarvi Sent: Thursday, April 07, 2005 6:23 PM To: Java RXTX discussion Subject: Re: [Rxtx] Input/output error in writeArray On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a > Windows box. Everything connects up fine, and I can send and receive > a simple sequence of bytes with no problems. However, if around 5 > seconds goes by without me sending something, I get the following when > I attempt to send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at mail.linuxgrrls.org http://mail.linuxgrrls.org/mailman/listinfo/rxtx From ricardo.trindade at emation.pt Mon Apr 4 09:17:23 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Mon, 04 Apr 2005 16:17:23 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot Message-ID: <42515A83.4050907@emation.pt> Hi, I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most recent stable snapshot), and get the following exception : It looks like rxtx has been compiled with jdk 1.5. If this was indeed the case, I think there is a compilation flag that generates code that runs on older jdks. java.lang.UnsupportedClassVersionError: gnu/io/UnsupportedCommOperationException (Unsupported major.minor version 49.0) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at java.net.URLClassLoader.defineClass(URLClassLoader.java:251) at java.net.URLClassLoader.access$100(URLClassLoader.java:55) at java.net.URLClassLoader$1.run(URLClassLoader.java:194) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:187) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:141) I'm trying to run it with 1.4. thanks Ricardo From taj at www.linux.org.uk Tue Apr 5 00:48:12 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 07:48:12 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42515A83.4050907@emation.pt> References: <42515A83.4050907@emation.pt> Message-ID: On Mon, 4 Apr 2005, Ricardo Trindade wrote: > Hi, > > I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most > recent stable snapshot), and get the following exception : > > It looks like rxtx has been compiled with jdk 1.5. If this was > indeed the case, I think there is a compilation flag that generates code > that runs on older jdks. > > java.lang.UnsupportedClassVersionError: > gnu/io/UnsupportedCommOperationException (Unsupported major.minor > version 49.0) [snip] Thanks Ricardo I recompiled the jar with javac -source 1.3 -target 1.3. That should cover most of the JRE's in use today. I also compiled the rxtx 2.0 x86_64 native library which appeared to be missing. I tried looking for flags to pass gcc 4.0 to make the native libraries more backwards compatible but only found options for C++ which is not used in rxtx. I've got a list of other bugs that I'll be going through in the next few weeks but for now I just left them with the same CVS filename - no code changes. ftp://ftp.qbang.org/pub/rxtx/rxtx-2.0-CVS-20050120-bins.tar.gz ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-CVS-20050120-bins.tar.gz -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Tue Apr 5 02:24:33 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 05 Apr 2005 09:24:33 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: References: <42515A83.4050907@emation.pt> Message-ID: <42524B41.3040300@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050405/5919abbb/attachment-0081.html From taj at www.linux.org.uk Tue Apr 5 03:00:29 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 10:00:29 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42524B41.3040300@emation.pt> References: <42515A83.4050907@emation.pt> <42524B41.3040300@emation.pt> Message-ID: On Tue, 5 Apr 2005, Ricardo Trindade wrote: > Will you anounce to the list when a new release is available ? > There will be several incremental releases announced here. Once those are done, we will release 2.1.7 and 2.0.7. -- Trent Jarvi taj at www.linux.org.uk From no_spam at somewhere.com Tue Apr 5 11:55:37 2005 From: no_spam at somewhere.com (no_spam@somewhere.com) Date: Tue, 5 Apr 2005 13:55:37 -0400 Subject: [Rxtx] Closing a port from an event listener results in a deadlock Message-ID: <20050405175537.GA21747@rcog.homelinux.net> On the message I sent on March 14, does anyone had the chance to try the modification? Or was it already fixed? (I haven't searched the archive extensively) Or maybe my message got catched by some spam filters? (it made it to the list archive though) Anyway, I would appreciate some feedback (through the list) Thanks From taj at www.linux.org.uk Tue Apr 5 14:42:28 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 21:42:28 +0100 (BST) Subject: [Rxtx] Closing a port from an event listener results in a deadlock In-Reply-To: <20050405175537.GA21747@rcog.homelinux.net> References: <20050405175537.GA21747@rcog.homelinux.net> Message-ID: On Tue, 5 Apr 2005 no_spam at somewhere.com wrote: > On the message I sent on March 14, does anyone had the chance to try the > modification? > > Or was it already fixed? (I haven't searched the archive extensively) > > Or maybe my message got catched by some spam filters? (it made it to the list > archive though) > > Anyway, I would appreciate some feedback (through the list) > The patch is here http://marc.theaimsgroup.com/?l=rxtx&m=111084488820288&w=2 I have applied this patch to a local copy but will not be doing formal testing for a couple weeks. I do not try to close ports from inside the eventListenter usually so I encourage any feedback also. If there are no problems reported, I expect this will go into rxtx 2.1-7. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Wed Apr 6 08:33:42 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Wed, 06 Apr 2005 15:33:42 +0100 Subject: [Rxtx] getting RXTX version Message-ID: <4253F346.50102@emation.pt> Hi, I want to make sure my deployments have the same version of RXTX jar and native lib. I know the version of the jar can be obtained in the Version class, but how can I obtain the native version ? I know RXTX prints to the console a warning if the version is different. Is there a way to programatically know is this is the case ? I would like to log that to our app's log thanks Ricardo From taj at www.linux.org.uk Wed Apr 6 15:10:20 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 6 Apr 2005 22:10:20 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4253F346.50102@emation.pt> References: <4253F346.50102@emation.pt> Message-ID: On Wed, 6 Apr 2005, Ricardo Trindade wrote: > Hi, > > I want to make sure my deployments have the same version of RXTX jar > and native lib. > > I know the version of the jar can be obtained in the Version class, > but how can I obtain the native version ? > > I know RXTX prints to the console a warning if the version is > different. Is there a way to programatically know is this is the case ? > > I would like to log that to our app's log > There isn't a suggested way of doing that right now. We could move things around and have a static String RXTXVersion.getNativeVersion() in future releases. Is this what you expected? This is not documented in commapi at all. I just tossed that in to catch conflicts while developing. It would be nice to have access in GUI applications though. It may be possible to access RXTXCommDriver.LibVersion right now. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Thu Apr 7 02:51:00 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 09:51:00 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> Message-ID: <4254F474.7020905@emation.pt> >There isn't a suggested way of doing that right now. We could move things >around and have a static String RXTXVersion.getNativeVersion() in future >releases. Is this what you expected? > > Yes, that would be perfect. >This is not documented in commapi at all. I just tossed that in to catch >conflicts while developing. It would be nice to have access in GUI >applications though. > >It may be possible to access RXTXCommDriver.LibVersion right now. > > > I tried, and I don't think it's possible. From taj at www.linux.org.uk Thu Apr 7 03:32:04 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 7 Apr 2005 10:32:04 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4254F474.7020905@emation.pt> References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: On Thu, 7 Apr 2005, Ricardo Trindade wrote: > > >There isn't a suggested way of doing that right now. We could move things > >around and have a static String RXTXVersion.getNativeVersion() in future > >releases. Is this what you expected? > > > > > > Yes, that would be perfect. > The attached should do what you want. You will still need to catch an exception for older versions... -- Trent Jarvi taj at www.linux.org.uk -------------- next part -------------- ? public_version.patch Index: RXTXCommDriver.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXCommDriver.java,v retrieving revision 1.16.2.51 diff -u -r1.16.2.51 RXTXCommDriver.java --- RXTXCommDriver.java 12 Oct 2004 09:13:30 -0000 1.16.2.51 +++ RXTXCommDriver.java 7 Apr 2005 09:29:04 -0000 @@ -54,7 +54,7 @@ the Library. */ String JarVersion = RXTXVersion.getVersion(); - String LibVersion = nativeGetVersion(); + String LibVersion = RXTXVersion.nativeGetVersion(); if ( devel ) { System.out.println("Devel Library"); @@ -76,7 +76,6 @@ /** Get the Serial port prefixes for the running OS */ private String deviceDirectory; private String osName; - private static native String nativeGetVersion(); private native boolean registerKnownPorts(int PortType); private native boolean isPortPrefixValid(String dev); private native boolean testRead(String dev, int type); Index: RXTXVersion.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXVersion.java,v retrieving revision 1.2.2.31 diff -u -r1.2.2.31 RXTXVersion.java --- RXTXVersion.java 16 Oct 2004 16:20:35 -0000 1.2.2.31 +++ RXTXVersion.java 7 Apr 2005 09:29:04 -0000 @@ -36,6 +36,7 @@ private static String Version; static { + System.loadLibrary( "rxtxSerial" ); Version = "RXTX-2.1-7pre20"; } /** @@ -47,4 +48,5 @@ { return(Version); } + public static native String nativeGetVersion(); } Index: SerialImp.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v retrieving revision 1.46.2.181 diff -u -r1.46.2.181 SerialImp.c --- SerialImp.c 17 Oct 2004 09:48:56 -0000 1.46.2.181 +++ SerialImp.c 7 Apr 2005 09:29:07 -0000 @@ -116,6 +116,7 @@ * It will eventually be removed. * */ #define RXTXPort(foo) Java_gnu_io_RXTXPort_ ## foo +#define RXTXVersion(foo) Java_gnu_io_RXTXVersion_ ## foo #define RXTXCommDriver(foo) Java_gnu_io_RXTXCommDriver_ ## foo #if defined(__sun__) || defined(__hpux__) @@ -4001,7 +4002,7 @@ } /*---------------------------------------------------------- -RXTXCommDriver.nativeGetVersion +RXTXVersion.nativeGetVersion accept: none perform: return the current version @@ -4010,9 +4011,10 @@ comments: This is used to avoid mixing versions of the .jar and native library. First introduced in rxtx-1.5-9 + Moved from RXTXCommDriver to RXTXVersion in rxtx-2.1-7 ----------------------------------------------------------*/ -JNIEXPORT jstring JNICALL RXTXCommDriver(nativeGetVersion) (JNIEnv *env, +JNIEXPORT jstring JNICALL RXTXVersion(nativeGetVersion) (JNIEnv *env, jclass jclazz ) { return (*env)->NewStringUTF( env, "RXTX-2.1-7pre20" ); From ricardo.trindade at emation.pt Thu Apr 7 03:45:58 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 10:45:58 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: <42550156.2040908@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050407/05212451/attachment-0081.html From thomas.shulok at lmco.com Thu Apr 7 17:43:11 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Thu, 07 Apr 2005 19:43:11 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi There, I'm attempting to talk RS232 between an embedded Linux box and a Windows box. Everything connects up fine, and I can send and receive a simple sequence of bytes with no problems. However, if around 5 seconds goes by without me sending something, I get the following when I attempt to send. java.io.IOException: Input/output error in writeArray Stack trace: java/lang/Throwable.()V java/lang/Throwable.(Ljava/lang/String;)V java/io/IOException.(Ljava/lang/String;)V gnu/io/RXTXPort.writeArray([BIIZ)V gnu/io/RXTXPort$SerialOutputStream.write([B)V SerialTest.main([Ljava/lang/String;)V If there interval is shorter (say 2 seconds between sends), I have no problems. On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and librxtxSerial-2.0.7pre2.so. Any ideas? Thanks, Thom -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5b23dcf/attachment-0081.html From taj at www.linux.org.uk Thu Apr 7 19:22:36 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:22:36 +0100 (BST) Subject: [Rxtx] Input/output error in writeArray In-Reply-To: References: Message-ID: On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a Windows > box. Everything connects up fine, and I can send and receive a simple > sequence of bytes with no problems. However, if around 5 seconds goes > by without me sending something, I get the following when I attempt to > send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Apr 7 19:24:59 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:24:59 +0100 (BST) Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) Message-ID: hmm. This would not work from applets would it? -- Trent Jarvi taj at www.linux.org.uk ---------- Forwarded message ---------- Date: Thu, 07 Apr 2005 16:05:53 -0400 From: Chris Gaffney To: taj at www.linux.org.uk Subject: RXTX Libraries on Classpath fix Hi, I submitted a patch for RXTX a few weeks ago to allow for loading the native libraries from the classpath. Since sending it to you I found it wasn't working on windows. I've fixed the problem and created a new patch that should replace the older one. The actual change is a one line from a String.equals() to a String.startsWith(). Thanks for a great piece of software, -Chris Gaffney Grand Valley State University -------------- next part -------------- A non-text attachment was scrubbed... Name: libraries_on_classpath_fixed.patch Type: text/x-patch Size: 5617 bytes Desc: Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5d423b8/libraries_on_classpath_fixed-0081.bin From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From thomas.shulok at lmco.com Fri Apr 8 10:38:55 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Fri, 08 Apr 2005 12:38:55 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi Trent, Thanks for the prompt response. Before diving deeper, I was wondering if there is a timeout parameter somewhere in the stack that I have not set properly. Given the nature of the failure (only fails if the line has been idle for a few seconds), it feels like some kind of timeout issue... Thanks again, Thom -----Original Message----- From: rxtx-bounces at mail.linuxgrrls.org [mailto:rxtx-bounces at mail.linuxgrrls.org] On Behalf Of Trent Jarvi Sent: Thursday, April 07, 2005 6:23 PM To: Java RXTX discussion Subject: Re: [Rxtx] Input/output error in writeArray On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a > Windows box. Everything connects up fine, and I can send and receive > a simple sequence of bytes with no problems. However, if around 5 > seconds goes by without me sending something, I get the following when > I attempt to send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at mail.linuxgrrls.org http://mail.linuxgrrls.org/mailman/listinfo/rxtx From ricardo.trindade at emation.pt Mon Apr 4 09:17:23 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Mon, 04 Apr 2005 16:17:23 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot Message-ID: <42515A83.4050907@emation.pt> Hi, I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most recent stable snapshot), and get the following exception : It looks like rxtx has been compiled with jdk 1.5. If this was indeed the case, I think there is a compilation flag that generates code that runs on older jdks. java.lang.UnsupportedClassVersionError: gnu/io/UnsupportedCommOperationException (Unsupported major.minor version 49.0) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at java.net.URLClassLoader.defineClass(URLClassLoader.java:251) at java.net.URLClassLoader.access$100(URLClassLoader.java:55) at java.net.URLClassLoader$1.run(URLClassLoader.java:194) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:187) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:141) I'm trying to run it with 1.4. thanks Ricardo From taj at www.linux.org.uk Tue Apr 5 00:48:12 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 07:48:12 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42515A83.4050907@emation.pt> References: <42515A83.4050907@emation.pt> Message-ID: On Mon, 4 Apr 2005, Ricardo Trindade wrote: > Hi, > > I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most > recent stable snapshot), and get the following exception : > > It looks like rxtx has been compiled with jdk 1.5. If this was > indeed the case, I think there is a compilation flag that generates code > that runs on older jdks. > > java.lang.UnsupportedClassVersionError: > gnu/io/UnsupportedCommOperationException (Unsupported major.minor > version 49.0) [snip] Thanks Ricardo I recompiled the jar with javac -source 1.3 -target 1.3. That should cover most of the JRE's in use today. I also compiled the rxtx 2.0 x86_64 native library which appeared to be missing. I tried looking for flags to pass gcc 4.0 to make the native libraries more backwards compatible but only found options for C++ which is not used in rxtx. I've got a list of other bugs that I'll be going through in the next few weeks but for now I just left them with the same CVS filename - no code changes. ftp://ftp.qbang.org/pub/rxtx/rxtx-2.0-CVS-20050120-bins.tar.gz ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-CVS-20050120-bins.tar.gz -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Tue Apr 5 02:24:33 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 05 Apr 2005 09:24:33 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: References: <42515A83.4050907@emation.pt> Message-ID: <42524B41.3040300@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050405/5919abbb/attachment-0082.html From taj at www.linux.org.uk Tue Apr 5 03:00:29 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 10:00:29 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42524B41.3040300@emation.pt> References: <42515A83.4050907@emation.pt> <42524B41.3040300@emation.pt> Message-ID: On Tue, 5 Apr 2005, Ricardo Trindade wrote: > Will you anounce to the list when a new release is available ? > There will be several incremental releases announced here. Once those are done, we will release 2.1.7 and 2.0.7. -- Trent Jarvi taj at www.linux.org.uk From no_spam at somewhere.com Tue Apr 5 11:55:37 2005 From: no_spam at somewhere.com (no_spam@somewhere.com) Date: Tue, 5 Apr 2005 13:55:37 -0400 Subject: [Rxtx] Closing a port from an event listener results in a deadlock Message-ID: <20050405175537.GA21747@rcog.homelinux.net> On the message I sent on March 14, does anyone had the chance to try the modification? Or was it already fixed? (I haven't searched the archive extensively) Or maybe my message got catched by some spam filters? (it made it to the list archive though) Anyway, I would appreciate some feedback (through the list) Thanks From taj at www.linux.org.uk Tue Apr 5 14:42:28 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 21:42:28 +0100 (BST) Subject: [Rxtx] Closing a port from an event listener results in a deadlock In-Reply-To: <20050405175537.GA21747@rcog.homelinux.net> References: <20050405175537.GA21747@rcog.homelinux.net> Message-ID: On Tue, 5 Apr 2005 no_spam at somewhere.com wrote: > On the message I sent on March 14, does anyone had the chance to try the > modification? > > Or was it already fixed? (I haven't searched the archive extensively) > > Or maybe my message got catched by some spam filters? (it made it to the list > archive though) > > Anyway, I would appreciate some feedback (through the list) > The patch is here http://marc.theaimsgroup.com/?l=rxtx&m=111084488820288&w=2 I have applied this patch to a local copy but will not be doing formal testing for a couple weeks. I do not try to close ports from inside the eventListenter usually so I encourage any feedback also. If there are no problems reported, I expect this will go into rxtx 2.1-7. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Wed Apr 6 08:33:42 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Wed, 06 Apr 2005 15:33:42 +0100 Subject: [Rxtx] getting RXTX version Message-ID: <4253F346.50102@emation.pt> Hi, I want to make sure my deployments have the same version of RXTX jar and native lib. I know the version of the jar can be obtained in the Version class, but how can I obtain the native version ? I know RXTX prints to the console a warning if the version is different. Is there a way to programatically know is this is the case ? I would like to log that to our app's log thanks Ricardo From taj at www.linux.org.uk Wed Apr 6 15:10:20 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 6 Apr 2005 22:10:20 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4253F346.50102@emation.pt> References: <4253F346.50102@emation.pt> Message-ID: On Wed, 6 Apr 2005, Ricardo Trindade wrote: > Hi, > > I want to make sure my deployments have the same version of RXTX jar > and native lib. > > I know the version of the jar can be obtained in the Version class, > but how can I obtain the native version ? > > I know RXTX prints to the console a warning if the version is > different. Is there a way to programatically know is this is the case ? > > I would like to log that to our app's log > There isn't a suggested way of doing that right now. We could move things around and have a static String RXTXVersion.getNativeVersion() in future releases. Is this what you expected? This is not documented in commapi at all. I just tossed that in to catch conflicts while developing. It would be nice to have access in GUI applications though. It may be possible to access RXTXCommDriver.LibVersion right now. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Thu Apr 7 02:51:00 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 09:51:00 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> Message-ID: <4254F474.7020905@emation.pt> >There isn't a suggested way of doing that right now. We could move things >around and have a static String RXTXVersion.getNativeVersion() in future >releases. Is this what you expected? > > Yes, that would be perfect. >This is not documented in commapi at all. I just tossed that in to catch >conflicts while developing. It would be nice to have access in GUI >applications though. > >It may be possible to access RXTXCommDriver.LibVersion right now. > > > I tried, and I don't think it's possible. From taj at www.linux.org.uk Thu Apr 7 03:32:04 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 7 Apr 2005 10:32:04 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4254F474.7020905@emation.pt> References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: On Thu, 7 Apr 2005, Ricardo Trindade wrote: > > >There isn't a suggested way of doing that right now. We could move things > >around and have a static String RXTXVersion.getNativeVersion() in future > >releases. Is this what you expected? > > > > > > Yes, that would be perfect. > The attached should do what you want. You will still need to catch an exception for older versions... -- Trent Jarvi taj at www.linux.org.uk -------------- next part -------------- ? public_version.patch Index: RXTXCommDriver.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXCommDriver.java,v retrieving revision 1.16.2.51 diff -u -r1.16.2.51 RXTXCommDriver.java --- RXTXCommDriver.java 12 Oct 2004 09:13:30 -0000 1.16.2.51 +++ RXTXCommDriver.java 7 Apr 2005 09:29:04 -0000 @@ -54,7 +54,7 @@ the Library. */ String JarVersion = RXTXVersion.getVersion(); - String LibVersion = nativeGetVersion(); + String LibVersion = RXTXVersion.nativeGetVersion(); if ( devel ) { System.out.println("Devel Library"); @@ -76,7 +76,6 @@ /** Get the Serial port prefixes for the running OS */ private String deviceDirectory; private String osName; - private static native String nativeGetVersion(); private native boolean registerKnownPorts(int PortType); private native boolean isPortPrefixValid(String dev); private native boolean testRead(String dev, int type); Index: RXTXVersion.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXVersion.java,v retrieving revision 1.2.2.31 diff -u -r1.2.2.31 RXTXVersion.java --- RXTXVersion.java 16 Oct 2004 16:20:35 -0000 1.2.2.31 +++ RXTXVersion.java 7 Apr 2005 09:29:04 -0000 @@ -36,6 +36,7 @@ private static String Version; static { + System.loadLibrary( "rxtxSerial" ); Version = "RXTX-2.1-7pre20"; } /** @@ -47,4 +48,5 @@ { return(Version); } + public static native String nativeGetVersion(); } Index: SerialImp.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v retrieving revision 1.46.2.181 diff -u -r1.46.2.181 SerialImp.c --- SerialImp.c 17 Oct 2004 09:48:56 -0000 1.46.2.181 +++ SerialImp.c 7 Apr 2005 09:29:07 -0000 @@ -116,6 +116,7 @@ * It will eventually be removed. * */ #define RXTXPort(foo) Java_gnu_io_RXTXPort_ ## foo +#define RXTXVersion(foo) Java_gnu_io_RXTXVersion_ ## foo #define RXTXCommDriver(foo) Java_gnu_io_RXTXCommDriver_ ## foo #if defined(__sun__) || defined(__hpux__) @@ -4001,7 +4002,7 @@ } /*---------------------------------------------------------- -RXTXCommDriver.nativeGetVersion +RXTXVersion.nativeGetVersion accept: none perform: return the current version @@ -4010,9 +4011,10 @@ comments: This is used to avoid mixing versions of the .jar and native library. First introduced in rxtx-1.5-9 + Moved from RXTXCommDriver to RXTXVersion in rxtx-2.1-7 ----------------------------------------------------------*/ -JNIEXPORT jstring JNICALL RXTXCommDriver(nativeGetVersion) (JNIEnv *env, +JNIEXPORT jstring JNICALL RXTXVersion(nativeGetVersion) (JNIEnv *env, jclass jclazz ) { return (*env)->NewStringUTF( env, "RXTX-2.1-7pre20" ); From ricardo.trindade at emation.pt Thu Apr 7 03:45:58 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 10:45:58 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: <42550156.2040908@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050407/05212451/attachment-0082.html From thomas.shulok at lmco.com Thu Apr 7 17:43:11 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Thu, 07 Apr 2005 19:43:11 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi There, I'm attempting to talk RS232 between an embedded Linux box and a Windows box. Everything connects up fine, and I can send and receive a simple sequence of bytes with no problems. However, if around 5 seconds goes by without me sending something, I get the following when I attempt to send. java.io.IOException: Input/output error in writeArray Stack trace: java/lang/Throwable.()V java/lang/Throwable.(Ljava/lang/String;)V java/io/IOException.(Ljava/lang/String;)V gnu/io/RXTXPort.writeArray([BIIZ)V gnu/io/RXTXPort$SerialOutputStream.write([B)V SerialTest.main([Ljava/lang/String;)V If there interval is shorter (say 2 seconds between sends), I have no problems. On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and librxtxSerial-2.0.7pre2.so. Any ideas? Thanks, Thom -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5b23dcf/attachment-0082.html From taj at www.linux.org.uk Thu Apr 7 19:22:36 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:22:36 +0100 (BST) Subject: [Rxtx] Input/output error in writeArray In-Reply-To: References: Message-ID: On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a Windows > box. Everything connects up fine, and I can send and receive a simple > sequence of bytes with no problems. However, if around 5 seconds goes > by without me sending something, I get the following when I attempt to > send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Apr 7 19:24:59 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:24:59 +0100 (BST) Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) Message-ID: hmm. This would not work from applets would it? -- Trent Jarvi taj at www.linux.org.uk ---------- Forwarded message ---------- Date: Thu, 07 Apr 2005 16:05:53 -0400 From: Chris Gaffney To: taj at www.linux.org.uk Subject: RXTX Libraries on Classpath fix Hi, I submitted a patch for RXTX a few weeks ago to allow for loading the native libraries from the classpath. Since sending it to you I found it wasn't working on windows. I've fixed the problem and created a new patch that should replace the older one. The actual change is a one line from a String.equals() to a String.startsWith(). Thanks for a great piece of software, -Chris Gaffney Grand Valley State University -------------- next part -------------- A non-text attachment was scrubbed... Name: libraries_on_classpath_fixed.patch Type: text/x-patch Size: 5617 bytes Desc: Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5d423b8/libraries_on_classpath_fixed-0082.bin From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From thomas.shulok at lmco.com Fri Apr 8 10:38:55 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Fri, 08 Apr 2005 12:38:55 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi Trent, Thanks for the prompt response. Before diving deeper, I was wondering if there is a timeout parameter somewhere in the stack that I have not set properly. Given the nature of the failure (only fails if the line has been idle for a few seconds), it feels like some kind of timeout issue... Thanks again, Thom -----Original Message----- From: rxtx-bounces at mail.linuxgrrls.org [mailto:rxtx-bounces at mail.linuxgrrls.org] On Behalf Of Trent Jarvi Sent: Thursday, April 07, 2005 6:23 PM To: Java RXTX discussion Subject: Re: [Rxtx] Input/output error in writeArray On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a > Windows box. Everything connects up fine, and I can send and receive > a simple sequence of bytes with no problems. However, if around 5 > seconds goes by without me sending something, I get the following when > I attempt to send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at mail.linuxgrrls.org http://mail.linuxgrrls.org/mailman/listinfo/rxtx From ricardo.trindade at emation.pt Mon Apr 4 09:17:23 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Mon, 04 Apr 2005 16:17:23 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot Message-ID: <42515A83.4050907@emation.pt> Hi, I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most recent stable snapshot), and get the following exception : It looks like rxtx has been compiled with jdk 1.5. If this was indeed the case, I think there is a compilation flag that generates code that runs on older jdks. java.lang.UnsupportedClassVersionError: gnu/io/UnsupportedCommOperationException (Unsupported major.minor version 49.0) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at java.net.URLClassLoader.defineClass(URLClassLoader.java:251) at java.net.URLClassLoader.access$100(URLClassLoader.java:55) at java.net.URLClassLoader$1.run(URLClassLoader.java:194) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:187) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:141) I'm trying to run it with 1.4. thanks Ricardo From taj at www.linux.org.uk Tue Apr 5 00:48:12 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 07:48:12 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42515A83.4050907@emation.pt> References: <42515A83.4050907@emation.pt> Message-ID: On Mon, 4 Apr 2005, Ricardo Trindade wrote: > Hi, > > I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most > recent stable snapshot), and get the following exception : > > It looks like rxtx has been compiled with jdk 1.5. If this was > indeed the case, I think there is a compilation flag that generates code > that runs on older jdks. > > java.lang.UnsupportedClassVersionError: > gnu/io/UnsupportedCommOperationException (Unsupported major.minor > version 49.0) [snip] Thanks Ricardo I recompiled the jar with javac -source 1.3 -target 1.3. That should cover most of the JRE's in use today. I also compiled the rxtx 2.0 x86_64 native library which appeared to be missing. I tried looking for flags to pass gcc 4.0 to make the native libraries more backwards compatible but only found options for C++ which is not used in rxtx. I've got a list of other bugs that I'll be going through in the next few weeks but for now I just left them with the same CVS filename - no code changes. ftp://ftp.qbang.org/pub/rxtx/rxtx-2.0-CVS-20050120-bins.tar.gz ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-CVS-20050120-bins.tar.gz -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Tue Apr 5 02:24:33 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 05 Apr 2005 09:24:33 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: References: <42515A83.4050907@emation.pt> Message-ID: <42524B41.3040300@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050405/5919abbb/attachment-0083.html From taj at www.linux.org.uk Tue Apr 5 03:00:29 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 10:00:29 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42524B41.3040300@emation.pt> References: <42515A83.4050907@emation.pt> <42524B41.3040300@emation.pt> Message-ID: On Tue, 5 Apr 2005, Ricardo Trindade wrote: > Will you anounce to the list when a new release is available ? > There will be several incremental releases announced here. Once those are done, we will release 2.1.7 and 2.0.7. -- Trent Jarvi taj at www.linux.org.uk From no_spam at somewhere.com Tue Apr 5 11:55:37 2005 From: no_spam at somewhere.com (no_spam@somewhere.com) Date: Tue, 5 Apr 2005 13:55:37 -0400 Subject: [Rxtx] Closing a port from an event listener results in a deadlock Message-ID: <20050405175537.GA21747@rcog.homelinux.net> On the message I sent on March 14, does anyone had the chance to try the modification? Or was it already fixed? (I haven't searched the archive extensively) Or maybe my message got catched by some spam filters? (it made it to the list archive though) Anyway, I would appreciate some feedback (through the list) Thanks From taj at www.linux.org.uk Tue Apr 5 14:42:28 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 21:42:28 +0100 (BST) Subject: [Rxtx] Closing a port from an event listener results in a deadlock In-Reply-To: <20050405175537.GA21747@rcog.homelinux.net> References: <20050405175537.GA21747@rcog.homelinux.net> Message-ID: On Tue, 5 Apr 2005 no_spam at somewhere.com wrote: > On the message I sent on March 14, does anyone had the chance to try the > modification? > > Or was it already fixed? (I haven't searched the archive extensively) > > Or maybe my message got catched by some spam filters? (it made it to the list > archive though) > > Anyway, I would appreciate some feedback (through the list) > The patch is here http://marc.theaimsgroup.com/?l=rxtx&m=111084488820288&w=2 I have applied this patch to a local copy but will not be doing formal testing for a couple weeks. I do not try to close ports from inside the eventListenter usually so I encourage any feedback also. If there are no problems reported, I expect this will go into rxtx 2.1-7. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Wed Apr 6 08:33:42 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Wed, 06 Apr 2005 15:33:42 +0100 Subject: [Rxtx] getting RXTX version Message-ID: <4253F346.50102@emation.pt> Hi, I want to make sure my deployments have the same version of RXTX jar and native lib. I know the version of the jar can be obtained in the Version class, but how can I obtain the native version ? I know RXTX prints to the console a warning if the version is different. Is there a way to programatically know is this is the case ? I would like to log that to our app's log thanks Ricardo From taj at www.linux.org.uk Wed Apr 6 15:10:20 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 6 Apr 2005 22:10:20 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4253F346.50102@emation.pt> References: <4253F346.50102@emation.pt> Message-ID: On Wed, 6 Apr 2005, Ricardo Trindade wrote: > Hi, > > I want to make sure my deployments have the same version of RXTX jar > and native lib. > > I know the version of the jar can be obtained in the Version class, > but how can I obtain the native version ? > > I know RXTX prints to the console a warning if the version is > different. Is there a way to programatically know is this is the case ? > > I would like to log that to our app's log > There isn't a suggested way of doing that right now. We could move things around and have a static String RXTXVersion.getNativeVersion() in future releases. Is this what you expected? This is not documented in commapi at all. I just tossed that in to catch conflicts while developing. It would be nice to have access in GUI applications though. It may be possible to access RXTXCommDriver.LibVersion right now. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Thu Apr 7 02:51:00 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 09:51:00 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> Message-ID: <4254F474.7020905@emation.pt> >There isn't a suggested way of doing that right now. We could move things >around and have a static String RXTXVersion.getNativeVersion() in future >releases. Is this what you expected? > > Yes, that would be perfect. >This is not documented in commapi at all. I just tossed that in to catch >conflicts while developing. It would be nice to have access in GUI >applications though. > >It may be possible to access RXTXCommDriver.LibVersion right now. > > > I tried, and I don't think it's possible. From taj at www.linux.org.uk Thu Apr 7 03:32:04 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 7 Apr 2005 10:32:04 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4254F474.7020905@emation.pt> References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: On Thu, 7 Apr 2005, Ricardo Trindade wrote: > > >There isn't a suggested way of doing that right now. We could move things > >around and have a static String RXTXVersion.getNativeVersion() in future > >releases. Is this what you expected? > > > > > > Yes, that would be perfect. > The attached should do what you want. You will still need to catch an exception for older versions... -- Trent Jarvi taj at www.linux.org.uk -------------- next part -------------- ? public_version.patch Index: RXTXCommDriver.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXCommDriver.java,v retrieving revision 1.16.2.51 diff -u -r1.16.2.51 RXTXCommDriver.java --- RXTXCommDriver.java 12 Oct 2004 09:13:30 -0000 1.16.2.51 +++ RXTXCommDriver.java 7 Apr 2005 09:29:04 -0000 @@ -54,7 +54,7 @@ the Library. */ String JarVersion = RXTXVersion.getVersion(); - String LibVersion = nativeGetVersion(); + String LibVersion = RXTXVersion.nativeGetVersion(); if ( devel ) { System.out.println("Devel Library"); @@ -76,7 +76,6 @@ /** Get the Serial port prefixes for the running OS */ private String deviceDirectory; private String osName; - private static native String nativeGetVersion(); private native boolean registerKnownPorts(int PortType); private native boolean isPortPrefixValid(String dev); private native boolean testRead(String dev, int type); Index: RXTXVersion.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXVersion.java,v retrieving revision 1.2.2.31 diff -u -r1.2.2.31 RXTXVersion.java --- RXTXVersion.java 16 Oct 2004 16:20:35 -0000 1.2.2.31 +++ RXTXVersion.java 7 Apr 2005 09:29:04 -0000 @@ -36,6 +36,7 @@ private static String Version; static { + System.loadLibrary( "rxtxSerial" ); Version = "RXTX-2.1-7pre20"; } /** @@ -47,4 +48,5 @@ { return(Version); } + public static native String nativeGetVersion(); } Index: SerialImp.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v retrieving revision 1.46.2.181 diff -u -r1.46.2.181 SerialImp.c --- SerialImp.c 17 Oct 2004 09:48:56 -0000 1.46.2.181 +++ SerialImp.c 7 Apr 2005 09:29:07 -0000 @@ -116,6 +116,7 @@ * It will eventually be removed. * */ #define RXTXPort(foo) Java_gnu_io_RXTXPort_ ## foo +#define RXTXVersion(foo) Java_gnu_io_RXTXVersion_ ## foo #define RXTXCommDriver(foo) Java_gnu_io_RXTXCommDriver_ ## foo #if defined(__sun__) || defined(__hpux__) @@ -4001,7 +4002,7 @@ } /*---------------------------------------------------------- -RXTXCommDriver.nativeGetVersion +RXTXVersion.nativeGetVersion accept: none perform: return the current version @@ -4010,9 +4011,10 @@ comments: This is used to avoid mixing versions of the .jar and native library. First introduced in rxtx-1.5-9 + Moved from RXTXCommDriver to RXTXVersion in rxtx-2.1-7 ----------------------------------------------------------*/ -JNIEXPORT jstring JNICALL RXTXCommDriver(nativeGetVersion) (JNIEnv *env, +JNIEXPORT jstring JNICALL RXTXVersion(nativeGetVersion) (JNIEnv *env, jclass jclazz ) { return (*env)->NewStringUTF( env, "RXTX-2.1-7pre20" ); From ricardo.trindade at emation.pt Thu Apr 7 03:45:58 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 10:45:58 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: <42550156.2040908@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050407/05212451/attachment-0083.html From thomas.shulok at lmco.com Thu Apr 7 17:43:11 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Thu, 07 Apr 2005 19:43:11 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi There, I'm attempting to talk RS232 between an embedded Linux box and a Windows box. Everything connects up fine, and I can send and receive a simple sequence of bytes with no problems. However, if around 5 seconds goes by without me sending something, I get the following when I attempt to send. java.io.IOException: Input/output error in writeArray Stack trace: java/lang/Throwable.()V java/lang/Throwable.(Ljava/lang/String;)V java/io/IOException.(Ljava/lang/String;)V gnu/io/RXTXPort.writeArray([BIIZ)V gnu/io/RXTXPort$SerialOutputStream.write([B)V SerialTest.main([Ljava/lang/String;)V If there interval is shorter (say 2 seconds between sends), I have no problems. On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and librxtxSerial-2.0.7pre2.so. Any ideas? Thanks, Thom -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5b23dcf/attachment-0083.html From taj at www.linux.org.uk Thu Apr 7 19:22:36 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:22:36 +0100 (BST) Subject: [Rxtx] Input/output error in writeArray In-Reply-To: References: Message-ID: On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a Windows > box. Everything connects up fine, and I can send and receive a simple > sequence of bytes with no problems. However, if around 5 seconds goes > by without me sending something, I get the following when I attempt to > send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Apr 7 19:24:59 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:24:59 +0100 (BST) Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) Message-ID: hmm. This would not work from applets would it? -- Trent Jarvi taj at www.linux.org.uk ---------- Forwarded message ---------- Date: Thu, 07 Apr 2005 16:05:53 -0400 From: Chris Gaffney To: taj at www.linux.org.uk Subject: RXTX Libraries on Classpath fix Hi, I submitted a patch for RXTX a few weeks ago to allow for loading the native libraries from the classpath. Since sending it to you I found it wasn't working on windows. I've fixed the problem and created a new patch that should replace the older one. The actual change is a one line from a String.equals() to a String.startsWith(). Thanks for a great piece of software, -Chris Gaffney Grand Valley State University -------------- next part -------------- A non-text attachment was scrubbed... Name: libraries_on_classpath_fixed.patch Type: text/x-patch Size: 5617 bytes Desc: Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5d423b8/libraries_on_classpath_fixed-0083.bin From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From thomas.shulok at lmco.com Fri Apr 8 10:38:55 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Fri, 08 Apr 2005 12:38:55 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi Trent, Thanks for the prompt response. Before diving deeper, I was wondering if there is a timeout parameter somewhere in the stack that I have not set properly. Given the nature of the failure (only fails if the line has been idle for a few seconds), it feels like some kind of timeout issue... Thanks again, Thom -----Original Message----- From: rxtx-bounces at mail.linuxgrrls.org [mailto:rxtx-bounces at mail.linuxgrrls.org] On Behalf Of Trent Jarvi Sent: Thursday, April 07, 2005 6:23 PM To: Java RXTX discussion Subject: Re: [Rxtx] Input/output error in writeArray On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a > Windows box. Everything connects up fine, and I can send and receive > a simple sequence of bytes with no problems. However, if around 5 > seconds goes by without me sending something, I get the following when > I attempt to send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at mail.linuxgrrls.org http://mail.linuxgrrls.org/mailman/listinfo/rxtx From ricardo.trindade at emation.pt Mon Apr 4 09:17:23 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Mon, 04 Apr 2005 16:17:23 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot Message-ID: <42515A83.4050907@emation.pt> Hi, I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most recent stable snapshot), and get the following exception : It looks like rxtx has been compiled with jdk 1.5. If this was indeed the case, I think there is a compilation flag that generates code that runs on older jdks. java.lang.UnsupportedClassVersionError: gnu/io/UnsupportedCommOperationException (Unsupported major.minor version 49.0) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at java.net.URLClassLoader.defineClass(URLClassLoader.java:251) at java.net.URLClassLoader.access$100(URLClassLoader.java:55) at java.net.URLClassLoader$1.run(URLClassLoader.java:194) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:187) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:141) I'm trying to run it with 1.4. thanks Ricardo From taj at www.linux.org.uk Tue Apr 5 00:48:12 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 07:48:12 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42515A83.4050907@emation.pt> References: <42515A83.4050907@emation.pt> Message-ID: On Mon, 4 Apr 2005, Ricardo Trindade wrote: > Hi, > > I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most > recent stable snapshot), and get the following exception : > > It looks like rxtx has been compiled with jdk 1.5. If this was > indeed the case, I think there is a compilation flag that generates code > that runs on older jdks. > > java.lang.UnsupportedClassVersionError: > gnu/io/UnsupportedCommOperationException (Unsupported major.minor > version 49.0) [snip] Thanks Ricardo I recompiled the jar with javac -source 1.3 -target 1.3. That should cover most of the JRE's in use today. I also compiled the rxtx 2.0 x86_64 native library which appeared to be missing. I tried looking for flags to pass gcc 4.0 to make the native libraries more backwards compatible but only found options for C++ which is not used in rxtx. I've got a list of other bugs that I'll be going through in the next few weeks but for now I just left them with the same CVS filename - no code changes. ftp://ftp.qbang.org/pub/rxtx/rxtx-2.0-CVS-20050120-bins.tar.gz ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-CVS-20050120-bins.tar.gz -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Tue Apr 5 02:24:33 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 05 Apr 2005 09:24:33 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: References: <42515A83.4050907@emation.pt> Message-ID: <42524B41.3040300@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050405/5919abbb/attachment-0084.html From taj at www.linux.org.uk Tue Apr 5 03:00:29 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 10:00:29 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42524B41.3040300@emation.pt> References: <42515A83.4050907@emation.pt> <42524B41.3040300@emation.pt> Message-ID: On Tue, 5 Apr 2005, Ricardo Trindade wrote: > Will you anounce to the list when a new release is available ? > There will be several incremental releases announced here. Once those are done, we will release 2.1.7 and 2.0.7. -- Trent Jarvi taj at www.linux.org.uk From no_spam at somewhere.com Tue Apr 5 11:55:37 2005 From: no_spam at somewhere.com (no_spam@somewhere.com) Date: Tue, 5 Apr 2005 13:55:37 -0400 Subject: [Rxtx] Closing a port from an event listener results in a deadlock Message-ID: <20050405175537.GA21747@rcog.homelinux.net> On the message I sent on March 14, does anyone had the chance to try the modification? Or was it already fixed? (I haven't searched the archive extensively) Or maybe my message got catched by some spam filters? (it made it to the list archive though) Anyway, I would appreciate some feedback (through the list) Thanks From taj at www.linux.org.uk Tue Apr 5 14:42:28 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 21:42:28 +0100 (BST) Subject: [Rxtx] Closing a port from an event listener results in a deadlock In-Reply-To: <20050405175537.GA21747@rcog.homelinux.net> References: <20050405175537.GA21747@rcog.homelinux.net> Message-ID: On Tue, 5 Apr 2005 no_spam at somewhere.com wrote: > On the message I sent on March 14, does anyone had the chance to try the > modification? > > Or was it already fixed? (I haven't searched the archive extensively) > > Or maybe my message got catched by some spam filters? (it made it to the list > archive though) > > Anyway, I would appreciate some feedback (through the list) > The patch is here http://marc.theaimsgroup.com/?l=rxtx&m=111084488820288&w=2 I have applied this patch to a local copy but will not be doing formal testing for a couple weeks. I do not try to close ports from inside the eventListenter usually so I encourage any feedback also. If there are no problems reported, I expect this will go into rxtx 2.1-7. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Wed Apr 6 08:33:42 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Wed, 06 Apr 2005 15:33:42 +0100 Subject: [Rxtx] getting RXTX version Message-ID: <4253F346.50102@emation.pt> Hi, I want to make sure my deployments have the same version of RXTX jar and native lib. I know the version of the jar can be obtained in the Version class, but how can I obtain the native version ? I know RXTX prints to the console a warning if the version is different. Is there a way to programatically know is this is the case ? I would like to log that to our app's log thanks Ricardo From taj at www.linux.org.uk Wed Apr 6 15:10:20 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 6 Apr 2005 22:10:20 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4253F346.50102@emation.pt> References: <4253F346.50102@emation.pt> Message-ID: On Wed, 6 Apr 2005, Ricardo Trindade wrote: > Hi, > > I want to make sure my deployments have the same version of RXTX jar > and native lib. > > I know the version of the jar can be obtained in the Version class, > but how can I obtain the native version ? > > I know RXTX prints to the console a warning if the version is > different. Is there a way to programatically know is this is the case ? > > I would like to log that to our app's log > There isn't a suggested way of doing that right now. We could move things around and have a static String RXTXVersion.getNativeVersion() in future releases. Is this what you expected? This is not documented in commapi at all. I just tossed that in to catch conflicts while developing. It would be nice to have access in GUI applications though. It may be possible to access RXTXCommDriver.LibVersion right now. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Thu Apr 7 02:51:00 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 09:51:00 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> Message-ID: <4254F474.7020905@emation.pt> >There isn't a suggested way of doing that right now. We could move things >around and have a static String RXTXVersion.getNativeVersion() in future >releases. Is this what you expected? > > Yes, that would be perfect. >This is not documented in commapi at all. I just tossed that in to catch >conflicts while developing. It would be nice to have access in GUI >applications though. > >It may be possible to access RXTXCommDriver.LibVersion right now. > > > I tried, and I don't think it's possible. From taj at www.linux.org.uk Thu Apr 7 03:32:04 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 7 Apr 2005 10:32:04 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4254F474.7020905@emation.pt> References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: On Thu, 7 Apr 2005, Ricardo Trindade wrote: > > >There isn't a suggested way of doing that right now. We could move things > >around and have a static String RXTXVersion.getNativeVersion() in future > >releases. Is this what you expected? > > > > > > Yes, that would be perfect. > The attached should do what you want. You will still need to catch an exception for older versions... -- Trent Jarvi taj at www.linux.org.uk -------------- next part -------------- ? public_version.patch Index: RXTXCommDriver.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXCommDriver.java,v retrieving revision 1.16.2.51 diff -u -r1.16.2.51 RXTXCommDriver.java --- RXTXCommDriver.java 12 Oct 2004 09:13:30 -0000 1.16.2.51 +++ RXTXCommDriver.java 7 Apr 2005 09:29:04 -0000 @@ -54,7 +54,7 @@ the Library. */ String JarVersion = RXTXVersion.getVersion(); - String LibVersion = nativeGetVersion(); + String LibVersion = RXTXVersion.nativeGetVersion(); if ( devel ) { System.out.println("Devel Library"); @@ -76,7 +76,6 @@ /** Get the Serial port prefixes for the running OS */ private String deviceDirectory; private String osName; - private static native String nativeGetVersion(); private native boolean registerKnownPorts(int PortType); private native boolean isPortPrefixValid(String dev); private native boolean testRead(String dev, int type); Index: RXTXVersion.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXVersion.java,v retrieving revision 1.2.2.31 diff -u -r1.2.2.31 RXTXVersion.java --- RXTXVersion.java 16 Oct 2004 16:20:35 -0000 1.2.2.31 +++ RXTXVersion.java 7 Apr 2005 09:29:04 -0000 @@ -36,6 +36,7 @@ private static String Version; static { + System.loadLibrary( "rxtxSerial" ); Version = "RXTX-2.1-7pre20"; } /** @@ -47,4 +48,5 @@ { return(Version); } + public static native String nativeGetVersion(); } Index: SerialImp.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v retrieving revision 1.46.2.181 diff -u -r1.46.2.181 SerialImp.c --- SerialImp.c 17 Oct 2004 09:48:56 -0000 1.46.2.181 +++ SerialImp.c 7 Apr 2005 09:29:07 -0000 @@ -116,6 +116,7 @@ * It will eventually be removed. * */ #define RXTXPort(foo) Java_gnu_io_RXTXPort_ ## foo +#define RXTXVersion(foo) Java_gnu_io_RXTXVersion_ ## foo #define RXTXCommDriver(foo) Java_gnu_io_RXTXCommDriver_ ## foo #if defined(__sun__) || defined(__hpux__) @@ -4001,7 +4002,7 @@ } /*---------------------------------------------------------- -RXTXCommDriver.nativeGetVersion +RXTXVersion.nativeGetVersion accept: none perform: return the current version @@ -4010,9 +4011,10 @@ comments: This is used to avoid mixing versions of the .jar and native library. First introduced in rxtx-1.5-9 + Moved from RXTXCommDriver to RXTXVersion in rxtx-2.1-7 ----------------------------------------------------------*/ -JNIEXPORT jstring JNICALL RXTXCommDriver(nativeGetVersion) (JNIEnv *env, +JNIEXPORT jstring JNICALL RXTXVersion(nativeGetVersion) (JNIEnv *env, jclass jclazz ) { return (*env)->NewStringUTF( env, "RXTX-2.1-7pre20" ); From ricardo.trindade at emation.pt Thu Apr 7 03:45:58 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 10:45:58 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: <42550156.2040908@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050407/05212451/attachment-0084.html From thomas.shulok at lmco.com Thu Apr 7 17:43:11 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Thu, 07 Apr 2005 19:43:11 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi There, I'm attempting to talk RS232 between an embedded Linux box and a Windows box. Everything connects up fine, and I can send and receive a simple sequence of bytes with no problems. However, if around 5 seconds goes by without me sending something, I get the following when I attempt to send. java.io.IOException: Input/output error in writeArray Stack trace: java/lang/Throwable.()V java/lang/Throwable.(Ljava/lang/String;)V java/io/IOException.(Ljava/lang/String;)V gnu/io/RXTXPort.writeArray([BIIZ)V gnu/io/RXTXPort$SerialOutputStream.write([B)V SerialTest.main([Ljava/lang/String;)V If there interval is shorter (say 2 seconds between sends), I have no problems. On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and librxtxSerial-2.0.7pre2.so. Any ideas? Thanks, Thom -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5b23dcf/attachment-0084.html From taj at www.linux.org.uk Thu Apr 7 19:22:36 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:22:36 +0100 (BST) Subject: [Rxtx] Input/output error in writeArray In-Reply-To: References: Message-ID: On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a Windows > box. Everything connects up fine, and I can send and receive a simple > sequence of bytes with no problems. However, if around 5 seconds goes > by without me sending something, I get the following when I attempt to > send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Apr 7 19:24:59 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:24:59 +0100 (BST) Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) Message-ID: hmm. This would not work from applets would it? -- Trent Jarvi taj at www.linux.org.uk ---------- Forwarded message ---------- Date: Thu, 07 Apr 2005 16:05:53 -0400 From: Chris Gaffney To: taj at www.linux.org.uk Subject: RXTX Libraries on Classpath fix Hi, I submitted a patch for RXTX a few weeks ago to allow for loading the native libraries from the classpath. Since sending it to you I found it wasn't working on windows. I've fixed the problem and created a new patch that should replace the older one. The actual change is a one line from a String.equals() to a String.startsWith(). Thanks for a great piece of software, -Chris Gaffney Grand Valley State University -------------- next part -------------- A non-text attachment was scrubbed... Name: libraries_on_classpath_fixed.patch Type: text/x-patch Size: 5617 bytes Desc: Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5d423b8/libraries_on_classpath_fixed-0084.bin From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From thomas.shulok at lmco.com Fri Apr 8 10:38:55 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Fri, 08 Apr 2005 12:38:55 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi Trent, Thanks for the prompt response. Before diving deeper, I was wondering if there is a timeout parameter somewhere in the stack that I have not set properly. Given the nature of the failure (only fails if the line has been idle for a few seconds), it feels like some kind of timeout issue... Thanks again, Thom -----Original Message----- From: rxtx-bounces at mail.linuxgrrls.org [mailto:rxtx-bounces at mail.linuxgrrls.org] On Behalf Of Trent Jarvi Sent: Thursday, April 07, 2005 6:23 PM To: Java RXTX discussion Subject: Re: [Rxtx] Input/output error in writeArray On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a > Windows box. Everything connects up fine, and I can send and receive > a simple sequence of bytes with no problems. However, if around 5 > seconds goes by without me sending something, I get the following when > I attempt to send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at mail.linuxgrrls.org http://mail.linuxgrrls.org/mailman/listinfo/rxtx From ricardo.trindade at emation.pt Mon Apr 4 09:17:23 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Mon, 04 Apr 2005 16:17:23 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot Message-ID: <42515A83.4050907@emation.pt> Hi, I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most recent stable snapshot), and get the following exception : It looks like rxtx has been compiled with jdk 1.5. If this was indeed the case, I think there is a compilation flag that generates code that runs on older jdks. java.lang.UnsupportedClassVersionError: gnu/io/UnsupportedCommOperationException (Unsupported major.minor version 49.0) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at java.net.URLClassLoader.defineClass(URLClassLoader.java:251) at java.net.URLClassLoader.access$100(URLClassLoader.java:55) at java.net.URLClassLoader$1.run(URLClassLoader.java:194) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:187) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:141) I'm trying to run it with 1.4. thanks Ricardo From taj at www.linux.org.uk Tue Apr 5 00:48:12 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 07:48:12 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42515A83.4050907@emation.pt> References: <42515A83.4050907@emation.pt> Message-ID: On Mon, 4 Apr 2005, Ricardo Trindade wrote: > Hi, > > I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most > recent stable snapshot), and get the following exception : > > It looks like rxtx has been compiled with jdk 1.5. If this was > indeed the case, I think there is a compilation flag that generates code > that runs on older jdks. > > java.lang.UnsupportedClassVersionError: > gnu/io/UnsupportedCommOperationException (Unsupported major.minor > version 49.0) [snip] Thanks Ricardo I recompiled the jar with javac -source 1.3 -target 1.3. That should cover most of the JRE's in use today. I also compiled the rxtx 2.0 x86_64 native library which appeared to be missing. I tried looking for flags to pass gcc 4.0 to make the native libraries more backwards compatible but only found options for C++ which is not used in rxtx. I've got a list of other bugs that I'll be going through in the next few weeks but for now I just left them with the same CVS filename - no code changes. ftp://ftp.qbang.org/pub/rxtx/rxtx-2.0-CVS-20050120-bins.tar.gz ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-CVS-20050120-bins.tar.gz -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Tue Apr 5 02:24:33 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 05 Apr 2005 09:24:33 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: References: <42515A83.4050907@emation.pt> Message-ID: <42524B41.3040300@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050405/5919abbb/attachment-0085.html From taj at www.linux.org.uk Tue Apr 5 03:00:29 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 10:00:29 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42524B41.3040300@emation.pt> References: <42515A83.4050907@emation.pt> <42524B41.3040300@emation.pt> Message-ID: On Tue, 5 Apr 2005, Ricardo Trindade wrote: > Will you anounce to the list when a new release is available ? > There will be several incremental releases announced here. Once those are done, we will release 2.1.7 and 2.0.7. -- Trent Jarvi taj at www.linux.org.uk From no_spam at somewhere.com Tue Apr 5 11:55:37 2005 From: no_spam at somewhere.com (no_spam@somewhere.com) Date: Tue, 5 Apr 2005 13:55:37 -0400 Subject: [Rxtx] Closing a port from an event listener results in a deadlock Message-ID: <20050405175537.GA21747@rcog.homelinux.net> On the message I sent on March 14, does anyone had the chance to try the modification? Or was it already fixed? (I haven't searched the archive extensively) Or maybe my message got catched by some spam filters? (it made it to the list archive though) Anyway, I would appreciate some feedback (through the list) Thanks From taj at www.linux.org.uk Tue Apr 5 14:42:28 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 21:42:28 +0100 (BST) Subject: [Rxtx] Closing a port from an event listener results in a deadlock In-Reply-To: <20050405175537.GA21747@rcog.homelinux.net> References: <20050405175537.GA21747@rcog.homelinux.net> Message-ID: On Tue, 5 Apr 2005 no_spam at somewhere.com wrote: > On the message I sent on March 14, does anyone had the chance to try the > modification? > > Or was it already fixed? (I haven't searched the archive extensively) > > Or maybe my message got catched by some spam filters? (it made it to the list > archive though) > > Anyway, I would appreciate some feedback (through the list) > The patch is here http://marc.theaimsgroup.com/?l=rxtx&m=111084488820288&w=2 I have applied this patch to a local copy but will not be doing formal testing for a couple weeks. I do not try to close ports from inside the eventListenter usually so I encourage any feedback also. If there are no problems reported, I expect this will go into rxtx 2.1-7. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Wed Apr 6 08:33:42 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Wed, 06 Apr 2005 15:33:42 +0100 Subject: [Rxtx] getting RXTX version Message-ID: <4253F346.50102@emation.pt> Hi, I want to make sure my deployments have the same version of RXTX jar and native lib. I know the version of the jar can be obtained in the Version class, but how can I obtain the native version ? I know RXTX prints to the console a warning if the version is different. Is there a way to programatically know is this is the case ? I would like to log that to our app's log thanks Ricardo From taj at www.linux.org.uk Wed Apr 6 15:10:20 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 6 Apr 2005 22:10:20 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4253F346.50102@emation.pt> References: <4253F346.50102@emation.pt> Message-ID: On Wed, 6 Apr 2005, Ricardo Trindade wrote: > Hi, > > I want to make sure my deployments have the same version of RXTX jar > and native lib. > > I know the version of the jar can be obtained in the Version class, > but how can I obtain the native version ? > > I know RXTX prints to the console a warning if the version is > different. Is there a way to programatically know is this is the case ? > > I would like to log that to our app's log > There isn't a suggested way of doing that right now. We could move things around and have a static String RXTXVersion.getNativeVersion() in future releases. Is this what you expected? This is not documented in commapi at all. I just tossed that in to catch conflicts while developing. It would be nice to have access in GUI applications though. It may be possible to access RXTXCommDriver.LibVersion right now. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Thu Apr 7 02:51:00 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 09:51:00 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> Message-ID: <4254F474.7020905@emation.pt> >There isn't a suggested way of doing that right now. We could move things >around and have a static String RXTXVersion.getNativeVersion() in future >releases. Is this what you expected? > > Yes, that would be perfect. >This is not documented in commapi at all. I just tossed that in to catch >conflicts while developing. It would be nice to have access in GUI >applications though. > >It may be possible to access RXTXCommDriver.LibVersion right now. > > > I tried, and I don't think it's possible. From taj at www.linux.org.uk Thu Apr 7 03:32:04 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 7 Apr 2005 10:32:04 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4254F474.7020905@emation.pt> References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: On Thu, 7 Apr 2005, Ricardo Trindade wrote: > > >There isn't a suggested way of doing that right now. We could move things > >around and have a static String RXTXVersion.getNativeVersion() in future > >releases. Is this what you expected? > > > > > > Yes, that would be perfect. > The attached should do what you want. You will still need to catch an exception for older versions... -- Trent Jarvi taj at www.linux.org.uk -------------- next part -------------- ? public_version.patch Index: RXTXCommDriver.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXCommDriver.java,v retrieving revision 1.16.2.51 diff -u -r1.16.2.51 RXTXCommDriver.java --- RXTXCommDriver.java 12 Oct 2004 09:13:30 -0000 1.16.2.51 +++ RXTXCommDriver.java 7 Apr 2005 09:29:04 -0000 @@ -54,7 +54,7 @@ the Library. */ String JarVersion = RXTXVersion.getVersion(); - String LibVersion = nativeGetVersion(); + String LibVersion = RXTXVersion.nativeGetVersion(); if ( devel ) { System.out.println("Devel Library"); @@ -76,7 +76,6 @@ /** Get the Serial port prefixes for the running OS */ private String deviceDirectory; private String osName; - private static native String nativeGetVersion(); private native boolean registerKnownPorts(int PortType); private native boolean isPortPrefixValid(String dev); private native boolean testRead(String dev, int type); Index: RXTXVersion.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXVersion.java,v retrieving revision 1.2.2.31 diff -u -r1.2.2.31 RXTXVersion.java --- RXTXVersion.java 16 Oct 2004 16:20:35 -0000 1.2.2.31 +++ RXTXVersion.java 7 Apr 2005 09:29:04 -0000 @@ -36,6 +36,7 @@ private static String Version; static { + System.loadLibrary( "rxtxSerial" ); Version = "RXTX-2.1-7pre20"; } /** @@ -47,4 +48,5 @@ { return(Version); } + public static native String nativeGetVersion(); } Index: SerialImp.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v retrieving revision 1.46.2.181 diff -u -r1.46.2.181 SerialImp.c --- SerialImp.c 17 Oct 2004 09:48:56 -0000 1.46.2.181 +++ SerialImp.c 7 Apr 2005 09:29:07 -0000 @@ -116,6 +116,7 @@ * It will eventually be removed. * */ #define RXTXPort(foo) Java_gnu_io_RXTXPort_ ## foo +#define RXTXVersion(foo) Java_gnu_io_RXTXVersion_ ## foo #define RXTXCommDriver(foo) Java_gnu_io_RXTXCommDriver_ ## foo #if defined(__sun__) || defined(__hpux__) @@ -4001,7 +4002,7 @@ } /*---------------------------------------------------------- -RXTXCommDriver.nativeGetVersion +RXTXVersion.nativeGetVersion accept: none perform: return the current version @@ -4010,9 +4011,10 @@ comments: This is used to avoid mixing versions of the .jar and native library. First introduced in rxtx-1.5-9 + Moved from RXTXCommDriver to RXTXVersion in rxtx-2.1-7 ----------------------------------------------------------*/ -JNIEXPORT jstring JNICALL RXTXCommDriver(nativeGetVersion) (JNIEnv *env, +JNIEXPORT jstring JNICALL RXTXVersion(nativeGetVersion) (JNIEnv *env, jclass jclazz ) { return (*env)->NewStringUTF( env, "RXTX-2.1-7pre20" ); From ricardo.trindade at emation.pt Thu Apr 7 03:45:58 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 10:45:58 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: <42550156.2040908@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050407/05212451/attachment-0085.html From thomas.shulok at lmco.com Thu Apr 7 17:43:11 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Thu, 07 Apr 2005 19:43:11 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi There, I'm attempting to talk RS232 between an embedded Linux box and a Windows box. Everything connects up fine, and I can send and receive a simple sequence of bytes with no problems. However, if around 5 seconds goes by without me sending something, I get the following when I attempt to send. java.io.IOException: Input/output error in writeArray Stack trace: java/lang/Throwable.()V java/lang/Throwable.(Ljava/lang/String;)V java/io/IOException.(Ljava/lang/String;)V gnu/io/RXTXPort.writeArray([BIIZ)V gnu/io/RXTXPort$SerialOutputStream.write([B)V SerialTest.main([Ljava/lang/String;)V If there interval is shorter (say 2 seconds between sends), I have no problems. On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and librxtxSerial-2.0.7pre2.so. Any ideas? Thanks, Thom -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5b23dcf/attachment-0085.html From taj at www.linux.org.uk Thu Apr 7 19:22:36 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:22:36 +0100 (BST) Subject: [Rxtx] Input/output error in writeArray In-Reply-To: References: Message-ID: On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a Windows > box. Everything connects up fine, and I can send and receive a simple > sequence of bytes with no problems. However, if around 5 seconds goes > by without me sending something, I get the following when I attempt to > send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Apr 7 19:24:59 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:24:59 +0100 (BST) Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) Message-ID: hmm. This would not work from applets would it? -- Trent Jarvi taj at www.linux.org.uk ---------- Forwarded message ---------- Date: Thu, 07 Apr 2005 16:05:53 -0400 From: Chris Gaffney To: taj at www.linux.org.uk Subject: RXTX Libraries on Classpath fix Hi, I submitted a patch for RXTX a few weeks ago to allow for loading the native libraries from the classpath. Since sending it to you I found it wasn't working on windows. I've fixed the problem and created a new patch that should replace the older one. The actual change is a one line from a String.equals() to a String.startsWith(). Thanks for a great piece of software, -Chris Gaffney Grand Valley State University -------------- next part -------------- A non-text attachment was scrubbed... Name: libraries_on_classpath_fixed.patch Type: text/x-patch Size: 5617 bytes Desc: Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5d423b8/libraries_on_classpath_fixed-0085.bin From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From thomas.shulok at lmco.com Fri Apr 8 10:38:55 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Fri, 08 Apr 2005 12:38:55 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi Trent, Thanks for the prompt response. Before diving deeper, I was wondering if there is a timeout parameter somewhere in the stack that I have not set properly. Given the nature of the failure (only fails if the line has been idle for a few seconds), it feels like some kind of timeout issue... Thanks again, Thom -----Original Message----- From: rxtx-bounces at mail.linuxgrrls.org [mailto:rxtx-bounces at mail.linuxgrrls.org] On Behalf Of Trent Jarvi Sent: Thursday, April 07, 2005 6:23 PM To: Java RXTX discussion Subject: Re: [Rxtx] Input/output error in writeArray On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a > Windows box. Everything connects up fine, and I can send and receive > a simple sequence of bytes with no problems. However, if around 5 > seconds goes by without me sending something, I get the following when > I attempt to send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at mail.linuxgrrls.org http://mail.linuxgrrls.org/mailman/listinfo/rxtx From ricardo.trindade at emation.pt Mon Apr 4 09:17:23 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Mon, 04 Apr 2005 16:17:23 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot Message-ID: <42515A83.4050907@emation.pt> Hi, I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most recent stable snapshot), and get the following exception : It looks like rxtx has been compiled with jdk 1.5. If this was indeed the case, I think there is a compilation flag that generates code that runs on older jdks. java.lang.UnsupportedClassVersionError: gnu/io/UnsupportedCommOperationException (Unsupported major.minor version 49.0) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at java.net.URLClassLoader.defineClass(URLClassLoader.java:251) at java.net.URLClassLoader.access$100(URLClassLoader.java:55) at java.net.URLClassLoader$1.run(URLClassLoader.java:194) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:187) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:141) I'm trying to run it with 1.4. thanks Ricardo From taj at www.linux.org.uk Tue Apr 5 00:48:12 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 07:48:12 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42515A83.4050907@emation.pt> References: <42515A83.4050907@emation.pt> Message-ID: On Mon, 4 Apr 2005, Ricardo Trindade wrote: > Hi, > > I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most > recent stable snapshot), and get the following exception : > > It looks like rxtx has been compiled with jdk 1.5. If this was > indeed the case, I think there is a compilation flag that generates code > that runs on older jdks. > > java.lang.UnsupportedClassVersionError: > gnu/io/UnsupportedCommOperationException (Unsupported major.minor > version 49.0) [snip] Thanks Ricardo I recompiled the jar with javac -source 1.3 -target 1.3. That should cover most of the JRE's in use today. I also compiled the rxtx 2.0 x86_64 native library which appeared to be missing. I tried looking for flags to pass gcc 4.0 to make the native libraries more backwards compatible but only found options for C++ which is not used in rxtx. I've got a list of other bugs that I'll be going through in the next few weeks but for now I just left them with the same CVS filename - no code changes. ftp://ftp.qbang.org/pub/rxtx/rxtx-2.0-CVS-20050120-bins.tar.gz ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-CVS-20050120-bins.tar.gz -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Tue Apr 5 02:24:33 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 05 Apr 2005 09:24:33 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: References: <42515A83.4050907@emation.pt> Message-ID: <42524B41.3040300@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050405/5919abbb/attachment-0086.html From taj at www.linux.org.uk Tue Apr 5 03:00:29 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 10:00:29 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42524B41.3040300@emation.pt> References: <42515A83.4050907@emation.pt> <42524B41.3040300@emation.pt> Message-ID: On Tue, 5 Apr 2005, Ricardo Trindade wrote: > Will you anounce to the list when a new release is available ? > There will be several incremental releases announced here. Once those are done, we will release 2.1.7 and 2.0.7. -- Trent Jarvi taj at www.linux.org.uk From no_spam at somewhere.com Tue Apr 5 11:55:37 2005 From: no_spam at somewhere.com (no_spam@somewhere.com) Date: Tue, 5 Apr 2005 13:55:37 -0400 Subject: [Rxtx] Closing a port from an event listener results in a deadlock Message-ID: <20050405175537.GA21747@rcog.homelinux.net> On the message I sent on March 14, does anyone had the chance to try the modification? Or was it already fixed? (I haven't searched the archive extensively) Or maybe my message got catched by some spam filters? (it made it to the list archive though) Anyway, I would appreciate some feedback (through the list) Thanks From taj at www.linux.org.uk Tue Apr 5 14:42:28 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 21:42:28 +0100 (BST) Subject: [Rxtx] Closing a port from an event listener results in a deadlock In-Reply-To: <20050405175537.GA21747@rcog.homelinux.net> References: <20050405175537.GA21747@rcog.homelinux.net> Message-ID: On Tue, 5 Apr 2005 no_spam at somewhere.com wrote: > On the message I sent on March 14, does anyone had the chance to try the > modification? > > Or was it already fixed? (I haven't searched the archive extensively) > > Or maybe my message got catched by some spam filters? (it made it to the list > archive though) > > Anyway, I would appreciate some feedback (through the list) > The patch is here http://marc.theaimsgroup.com/?l=rxtx&m=111084488820288&w=2 I have applied this patch to a local copy but will not be doing formal testing for a couple weeks. I do not try to close ports from inside the eventListenter usually so I encourage any feedback also. If there are no problems reported, I expect this will go into rxtx 2.1-7. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Wed Apr 6 08:33:42 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Wed, 06 Apr 2005 15:33:42 +0100 Subject: [Rxtx] getting RXTX version Message-ID: <4253F346.50102@emation.pt> Hi, I want to make sure my deployments have the same version of RXTX jar and native lib. I know the version of the jar can be obtained in the Version class, but how can I obtain the native version ? I know RXTX prints to the console a warning if the version is different. Is there a way to programatically know is this is the case ? I would like to log that to our app's log thanks Ricardo From taj at www.linux.org.uk Wed Apr 6 15:10:20 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 6 Apr 2005 22:10:20 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4253F346.50102@emation.pt> References: <4253F346.50102@emation.pt> Message-ID: On Wed, 6 Apr 2005, Ricardo Trindade wrote: > Hi, > > I want to make sure my deployments have the same version of RXTX jar > and native lib. > > I know the version of the jar can be obtained in the Version class, > but how can I obtain the native version ? > > I know RXTX prints to the console a warning if the version is > different. Is there a way to programatically know is this is the case ? > > I would like to log that to our app's log > There isn't a suggested way of doing that right now. We could move things around and have a static String RXTXVersion.getNativeVersion() in future releases. Is this what you expected? This is not documented in commapi at all. I just tossed that in to catch conflicts while developing. It would be nice to have access in GUI applications though. It may be possible to access RXTXCommDriver.LibVersion right now. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Thu Apr 7 02:51:00 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 09:51:00 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> Message-ID: <4254F474.7020905@emation.pt> >There isn't a suggested way of doing that right now. We could move things >around and have a static String RXTXVersion.getNativeVersion() in future >releases. Is this what you expected? > > Yes, that would be perfect. >This is not documented in commapi at all. I just tossed that in to catch >conflicts while developing. It would be nice to have access in GUI >applications though. > >It may be possible to access RXTXCommDriver.LibVersion right now. > > > I tried, and I don't think it's possible. From taj at www.linux.org.uk Thu Apr 7 03:32:04 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 7 Apr 2005 10:32:04 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4254F474.7020905@emation.pt> References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: On Thu, 7 Apr 2005, Ricardo Trindade wrote: > > >There isn't a suggested way of doing that right now. We could move things > >around and have a static String RXTXVersion.getNativeVersion() in future > >releases. Is this what you expected? > > > > > > Yes, that would be perfect. > The attached should do what you want. You will still need to catch an exception for older versions... -- Trent Jarvi taj at www.linux.org.uk -------------- next part -------------- ? public_version.patch Index: RXTXCommDriver.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXCommDriver.java,v retrieving revision 1.16.2.51 diff -u -r1.16.2.51 RXTXCommDriver.java --- RXTXCommDriver.java 12 Oct 2004 09:13:30 -0000 1.16.2.51 +++ RXTXCommDriver.java 7 Apr 2005 09:29:04 -0000 @@ -54,7 +54,7 @@ the Library. */ String JarVersion = RXTXVersion.getVersion(); - String LibVersion = nativeGetVersion(); + String LibVersion = RXTXVersion.nativeGetVersion(); if ( devel ) { System.out.println("Devel Library"); @@ -76,7 +76,6 @@ /** Get the Serial port prefixes for the running OS */ private String deviceDirectory; private String osName; - private static native String nativeGetVersion(); private native boolean registerKnownPorts(int PortType); private native boolean isPortPrefixValid(String dev); private native boolean testRead(String dev, int type); Index: RXTXVersion.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXVersion.java,v retrieving revision 1.2.2.31 diff -u -r1.2.2.31 RXTXVersion.java --- RXTXVersion.java 16 Oct 2004 16:20:35 -0000 1.2.2.31 +++ RXTXVersion.java 7 Apr 2005 09:29:04 -0000 @@ -36,6 +36,7 @@ private static String Version; static { + System.loadLibrary( "rxtxSerial" ); Version = "RXTX-2.1-7pre20"; } /** @@ -47,4 +48,5 @@ { return(Version); } + public static native String nativeGetVersion(); } Index: SerialImp.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v retrieving revision 1.46.2.181 diff -u -r1.46.2.181 SerialImp.c --- SerialImp.c 17 Oct 2004 09:48:56 -0000 1.46.2.181 +++ SerialImp.c 7 Apr 2005 09:29:07 -0000 @@ -116,6 +116,7 @@ * It will eventually be removed. * */ #define RXTXPort(foo) Java_gnu_io_RXTXPort_ ## foo +#define RXTXVersion(foo) Java_gnu_io_RXTXVersion_ ## foo #define RXTXCommDriver(foo) Java_gnu_io_RXTXCommDriver_ ## foo #if defined(__sun__) || defined(__hpux__) @@ -4001,7 +4002,7 @@ } /*---------------------------------------------------------- -RXTXCommDriver.nativeGetVersion +RXTXVersion.nativeGetVersion accept: none perform: return the current version @@ -4010,9 +4011,10 @@ comments: This is used to avoid mixing versions of the .jar and native library. First introduced in rxtx-1.5-9 + Moved from RXTXCommDriver to RXTXVersion in rxtx-2.1-7 ----------------------------------------------------------*/ -JNIEXPORT jstring JNICALL RXTXCommDriver(nativeGetVersion) (JNIEnv *env, +JNIEXPORT jstring JNICALL RXTXVersion(nativeGetVersion) (JNIEnv *env, jclass jclazz ) { return (*env)->NewStringUTF( env, "RXTX-2.1-7pre20" ); From ricardo.trindade at emation.pt Thu Apr 7 03:45:58 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 10:45:58 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: <42550156.2040908@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050407/05212451/attachment-0086.html From thomas.shulok at lmco.com Thu Apr 7 17:43:11 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Thu, 07 Apr 2005 19:43:11 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi There, I'm attempting to talk RS232 between an embedded Linux box and a Windows box. Everything connects up fine, and I can send and receive a simple sequence of bytes with no problems. However, if around 5 seconds goes by without me sending something, I get the following when I attempt to send. java.io.IOException: Input/output error in writeArray Stack trace: java/lang/Throwable.()V java/lang/Throwable.(Ljava/lang/String;)V java/io/IOException.(Ljava/lang/String;)V gnu/io/RXTXPort.writeArray([BIIZ)V gnu/io/RXTXPort$SerialOutputStream.write([B)V SerialTest.main([Ljava/lang/String;)V If there interval is shorter (say 2 seconds between sends), I have no problems. On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and librxtxSerial-2.0.7pre2.so. Any ideas? Thanks, Thom -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5b23dcf/attachment-0086.html From taj at www.linux.org.uk Thu Apr 7 19:22:36 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:22:36 +0100 (BST) Subject: [Rxtx] Input/output error in writeArray In-Reply-To: References: Message-ID: On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a Windows > box. Everything connects up fine, and I can send and receive a simple > sequence of bytes with no problems. However, if around 5 seconds goes > by without me sending something, I get the following when I attempt to > send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Apr 7 19:24:59 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:24:59 +0100 (BST) Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) Message-ID: hmm. This would not work from applets would it? -- Trent Jarvi taj at www.linux.org.uk ---------- Forwarded message ---------- Date: Thu, 07 Apr 2005 16:05:53 -0400 From: Chris Gaffney To: taj at www.linux.org.uk Subject: RXTX Libraries on Classpath fix Hi, I submitted a patch for RXTX a few weeks ago to allow for loading the native libraries from the classpath. Since sending it to you I found it wasn't working on windows. I've fixed the problem and created a new patch that should replace the older one. The actual change is a one line from a String.equals() to a String.startsWith(). Thanks for a great piece of software, -Chris Gaffney Grand Valley State University -------------- next part -------------- A non-text attachment was scrubbed... Name: libraries_on_classpath_fixed.patch Type: text/x-patch Size: 5617 bytes Desc: Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5d423b8/libraries_on_classpath_fixed-0086.bin From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From thomas.shulok at lmco.com Fri Apr 8 10:38:55 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Fri, 08 Apr 2005 12:38:55 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi Trent, Thanks for the prompt response. Before diving deeper, I was wondering if there is a timeout parameter somewhere in the stack that I have not set properly. Given the nature of the failure (only fails if the line has been idle for a few seconds), it feels like some kind of timeout issue... Thanks again, Thom -----Original Message----- From: rxtx-bounces at mail.linuxgrrls.org [mailto:rxtx-bounces at mail.linuxgrrls.org] On Behalf Of Trent Jarvi Sent: Thursday, April 07, 2005 6:23 PM To: Java RXTX discussion Subject: Re: [Rxtx] Input/output error in writeArray On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a > Windows box. Everything connects up fine, and I can send and receive > a simple sequence of bytes with no problems. However, if around 5 > seconds goes by without me sending something, I get the following when > I attempt to send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at mail.linuxgrrls.org http://mail.linuxgrrls.org/mailman/listinfo/rxtx From ricardo.trindade at emation.pt Mon Apr 4 09:17:23 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Mon, 04 Apr 2005 16:17:23 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot Message-ID: <42515A83.4050907@emation.pt> Hi, I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most recent stable snapshot), and get the following exception : It looks like rxtx has been compiled with jdk 1.5. If this was indeed the case, I think there is a compilation flag that generates code that runs on older jdks. java.lang.UnsupportedClassVersionError: gnu/io/UnsupportedCommOperationException (Unsupported major.minor version 49.0) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at java.net.URLClassLoader.defineClass(URLClassLoader.java:251) at java.net.URLClassLoader.access$100(URLClassLoader.java:55) at java.net.URLClassLoader$1.run(URLClassLoader.java:194) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:187) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:141) I'm trying to run it with 1.4. thanks Ricardo From taj at www.linux.org.uk Tue Apr 5 00:48:12 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 07:48:12 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42515A83.4050907@emation.pt> References: <42515A83.4050907@emation.pt> Message-ID: On Mon, 4 Apr 2005, Ricardo Trindade wrote: > Hi, > > I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most > recent stable snapshot), and get the following exception : > > It looks like rxtx has been compiled with jdk 1.5. If this was > indeed the case, I think there is a compilation flag that generates code > that runs on older jdks. > > java.lang.UnsupportedClassVersionError: > gnu/io/UnsupportedCommOperationException (Unsupported major.minor > version 49.0) [snip] Thanks Ricardo I recompiled the jar with javac -source 1.3 -target 1.3. That should cover most of the JRE's in use today. I also compiled the rxtx 2.0 x86_64 native library which appeared to be missing. I tried looking for flags to pass gcc 4.0 to make the native libraries more backwards compatible but only found options for C++ which is not used in rxtx. I've got a list of other bugs that I'll be going through in the next few weeks but for now I just left them with the same CVS filename - no code changes. ftp://ftp.qbang.org/pub/rxtx/rxtx-2.0-CVS-20050120-bins.tar.gz ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-CVS-20050120-bins.tar.gz -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Tue Apr 5 02:24:33 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 05 Apr 2005 09:24:33 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: References: <42515A83.4050907@emation.pt> Message-ID: <42524B41.3040300@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050405/5919abbb/attachment-0087.html From taj at www.linux.org.uk Tue Apr 5 03:00:29 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 10:00:29 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42524B41.3040300@emation.pt> References: <42515A83.4050907@emation.pt> <42524B41.3040300@emation.pt> Message-ID: On Tue, 5 Apr 2005, Ricardo Trindade wrote: > Will you anounce to the list when a new release is available ? > There will be several incremental releases announced here. Once those are done, we will release 2.1.7 and 2.0.7. -- Trent Jarvi taj at www.linux.org.uk From no_spam at somewhere.com Tue Apr 5 11:55:37 2005 From: no_spam at somewhere.com (no_spam@somewhere.com) Date: Tue, 5 Apr 2005 13:55:37 -0400 Subject: [Rxtx] Closing a port from an event listener results in a deadlock Message-ID: <20050405175537.GA21747@rcog.homelinux.net> On the message I sent on March 14, does anyone had the chance to try the modification? Or was it already fixed? (I haven't searched the archive extensively) Or maybe my message got catched by some spam filters? (it made it to the list archive though) Anyway, I would appreciate some feedback (through the list) Thanks From taj at www.linux.org.uk Tue Apr 5 14:42:28 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 21:42:28 +0100 (BST) Subject: [Rxtx] Closing a port from an event listener results in a deadlock In-Reply-To: <20050405175537.GA21747@rcog.homelinux.net> References: <20050405175537.GA21747@rcog.homelinux.net> Message-ID: On Tue, 5 Apr 2005 no_spam at somewhere.com wrote: > On the message I sent on March 14, does anyone had the chance to try the > modification? > > Or was it already fixed? (I haven't searched the archive extensively) > > Or maybe my message got catched by some spam filters? (it made it to the list > archive though) > > Anyway, I would appreciate some feedback (through the list) > The patch is here http://marc.theaimsgroup.com/?l=rxtx&m=111084488820288&w=2 I have applied this patch to a local copy but will not be doing formal testing for a couple weeks. I do not try to close ports from inside the eventListenter usually so I encourage any feedback also. If there are no problems reported, I expect this will go into rxtx 2.1-7. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Wed Apr 6 08:33:42 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Wed, 06 Apr 2005 15:33:42 +0100 Subject: [Rxtx] getting RXTX version Message-ID: <4253F346.50102@emation.pt> Hi, I want to make sure my deployments have the same version of RXTX jar and native lib. I know the version of the jar can be obtained in the Version class, but how can I obtain the native version ? I know RXTX prints to the console a warning if the version is different. Is there a way to programatically know is this is the case ? I would like to log that to our app's log thanks Ricardo From taj at www.linux.org.uk Wed Apr 6 15:10:20 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 6 Apr 2005 22:10:20 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4253F346.50102@emation.pt> References: <4253F346.50102@emation.pt> Message-ID: On Wed, 6 Apr 2005, Ricardo Trindade wrote: > Hi, > > I want to make sure my deployments have the same version of RXTX jar > and native lib. > > I know the version of the jar can be obtained in the Version class, > but how can I obtain the native version ? > > I know RXTX prints to the console a warning if the version is > different. Is there a way to programatically know is this is the case ? > > I would like to log that to our app's log > There isn't a suggested way of doing that right now. We could move things around and have a static String RXTXVersion.getNativeVersion() in future releases. Is this what you expected? This is not documented in commapi at all. I just tossed that in to catch conflicts while developing. It would be nice to have access in GUI applications though. It may be possible to access RXTXCommDriver.LibVersion right now. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Thu Apr 7 02:51:00 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 09:51:00 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> Message-ID: <4254F474.7020905@emation.pt> >There isn't a suggested way of doing that right now. We could move things >around and have a static String RXTXVersion.getNativeVersion() in future >releases. Is this what you expected? > > Yes, that would be perfect. >This is not documented in commapi at all. I just tossed that in to catch >conflicts while developing. It would be nice to have access in GUI >applications though. > >It may be possible to access RXTXCommDriver.LibVersion right now. > > > I tried, and I don't think it's possible. From taj at www.linux.org.uk Thu Apr 7 03:32:04 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 7 Apr 2005 10:32:04 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4254F474.7020905@emation.pt> References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: On Thu, 7 Apr 2005, Ricardo Trindade wrote: > > >There isn't a suggested way of doing that right now. We could move things > >around and have a static String RXTXVersion.getNativeVersion() in future > >releases. Is this what you expected? > > > > > > Yes, that would be perfect. > The attached should do what you want. You will still need to catch an exception for older versions... -- Trent Jarvi taj at www.linux.org.uk -------------- next part -------------- ? public_version.patch Index: RXTXCommDriver.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXCommDriver.java,v retrieving revision 1.16.2.51 diff -u -r1.16.2.51 RXTXCommDriver.java --- RXTXCommDriver.java 12 Oct 2004 09:13:30 -0000 1.16.2.51 +++ RXTXCommDriver.java 7 Apr 2005 09:29:04 -0000 @@ -54,7 +54,7 @@ the Library. */ String JarVersion = RXTXVersion.getVersion(); - String LibVersion = nativeGetVersion(); + String LibVersion = RXTXVersion.nativeGetVersion(); if ( devel ) { System.out.println("Devel Library"); @@ -76,7 +76,6 @@ /** Get the Serial port prefixes for the running OS */ private String deviceDirectory; private String osName; - private static native String nativeGetVersion(); private native boolean registerKnownPorts(int PortType); private native boolean isPortPrefixValid(String dev); private native boolean testRead(String dev, int type); Index: RXTXVersion.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXVersion.java,v retrieving revision 1.2.2.31 diff -u -r1.2.2.31 RXTXVersion.java --- RXTXVersion.java 16 Oct 2004 16:20:35 -0000 1.2.2.31 +++ RXTXVersion.java 7 Apr 2005 09:29:04 -0000 @@ -36,6 +36,7 @@ private static String Version; static { + System.loadLibrary( "rxtxSerial" ); Version = "RXTX-2.1-7pre20"; } /** @@ -47,4 +48,5 @@ { return(Version); } + public static native String nativeGetVersion(); } Index: SerialImp.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v retrieving revision 1.46.2.181 diff -u -r1.46.2.181 SerialImp.c --- SerialImp.c 17 Oct 2004 09:48:56 -0000 1.46.2.181 +++ SerialImp.c 7 Apr 2005 09:29:07 -0000 @@ -116,6 +116,7 @@ * It will eventually be removed. * */ #define RXTXPort(foo) Java_gnu_io_RXTXPort_ ## foo +#define RXTXVersion(foo) Java_gnu_io_RXTXVersion_ ## foo #define RXTXCommDriver(foo) Java_gnu_io_RXTXCommDriver_ ## foo #if defined(__sun__) || defined(__hpux__) @@ -4001,7 +4002,7 @@ } /*---------------------------------------------------------- -RXTXCommDriver.nativeGetVersion +RXTXVersion.nativeGetVersion accept: none perform: return the current version @@ -4010,9 +4011,10 @@ comments: This is used to avoid mixing versions of the .jar and native library. First introduced in rxtx-1.5-9 + Moved from RXTXCommDriver to RXTXVersion in rxtx-2.1-7 ----------------------------------------------------------*/ -JNIEXPORT jstring JNICALL RXTXCommDriver(nativeGetVersion) (JNIEnv *env, +JNIEXPORT jstring JNICALL RXTXVersion(nativeGetVersion) (JNIEnv *env, jclass jclazz ) { return (*env)->NewStringUTF( env, "RXTX-2.1-7pre20" ); From ricardo.trindade at emation.pt Thu Apr 7 03:45:58 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 10:45:58 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: <42550156.2040908@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050407/05212451/attachment-0087.html From thomas.shulok at lmco.com Thu Apr 7 17:43:11 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Thu, 07 Apr 2005 19:43:11 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi There, I'm attempting to talk RS232 between an embedded Linux box and a Windows box. Everything connects up fine, and I can send and receive a simple sequence of bytes with no problems. However, if around 5 seconds goes by without me sending something, I get the following when I attempt to send. java.io.IOException: Input/output error in writeArray Stack trace: java/lang/Throwable.()V java/lang/Throwable.(Ljava/lang/String;)V java/io/IOException.(Ljava/lang/String;)V gnu/io/RXTXPort.writeArray([BIIZ)V gnu/io/RXTXPort$SerialOutputStream.write([B)V SerialTest.main([Ljava/lang/String;)V If there interval is shorter (say 2 seconds between sends), I have no problems. On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and librxtxSerial-2.0.7pre2.so. Any ideas? Thanks, Thom -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5b23dcf/attachment-0087.html From taj at www.linux.org.uk Thu Apr 7 19:22:36 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:22:36 +0100 (BST) Subject: [Rxtx] Input/output error in writeArray In-Reply-To: References: Message-ID: On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a Windows > box. Everything connects up fine, and I can send and receive a simple > sequence of bytes with no problems. However, if around 5 seconds goes > by without me sending something, I get the following when I attempt to > send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Apr 7 19:24:59 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:24:59 +0100 (BST) Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) Message-ID: hmm. This would not work from applets would it? -- Trent Jarvi taj at www.linux.org.uk ---------- Forwarded message ---------- Date: Thu, 07 Apr 2005 16:05:53 -0400 From: Chris Gaffney To: taj at www.linux.org.uk Subject: RXTX Libraries on Classpath fix Hi, I submitted a patch for RXTX a few weeks ago to allow for loading the native libraries from the classpath. Since sending it to you I found it wasn't working on windows. I've fixed the problem and created a new patch that should replace the older one. The actual change is a one line from a String.equals() to a String.startsWith(). Thanks for a great piece of software, -Chris Gaffney Grand Valley State University -------------- next part -------------- A non-text attachment was scrubbed... Name: libraries_on_classpath_fixed.patch Type: text/x-patch Size: 5617 bytes Desc: Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5d423b8/libraries_on_classpath_fixed-0087.bin From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From thomas.shulok at lmco.com Fri Apr 8 10:38:55 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Fri, 08 Apr 2005 12:38:55 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi Trent, Thanks for the prompt response. Before diving deeper, I was wondering if there is a timeout parameter somewhere in the stack that I have not set properly. Given the nature of the failure (only fails if the line has been idle for a few seconds), it feels like some kind of timeout issue... Thanks again, Thom -----Original Message----- From: rxtx-bounces at mail.linuxgrrls.org [mailto:rxtx-bounces at mail.linuxgrrls.org] On Behalf Of Trent Jarvi Sent: Thursday, April 07, 2005 6:23 PM To: Java RXTX discussion Subject: Re: [Rxtx] Input/output error in writeArray On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a > Windows box. Everything connects up fine, and I can send and receive > a simple sequence of bytes with no problems. However, if around 5 > seconds goes by without me sending something, I get the following when > I attempt to send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at mail.linuxgrrls.org http://mail.linuxgrrls.org/mailman/listinfo/rxtx From ricardo.trindade at emation.pt Mon Apr 4 09:17:23 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Mon, 04 Apr 2005 16:17:23 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot Message-ID: <42515A83.4050907@emation.pt> Hi, I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most recent stable snapshot), and get the following exception : It looks like rxtx has been compiled with jdk 1.5. If this was indeed the case, I think there is a compilation flag that generates code that runs on older jdks. java.lang.UnsupportedClassVersionError: gnu/io/UnsupportedCommOperationException (Unsupported major.minor version 49.0) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at java.net.URLClassLoader.defineClass(URLClassLoader.java:251) at java.net.URLClassLoader.access$100(URLClassLoader.java:55) at java.net.URLClassLoader$1.run(URLClassLoader.java:194) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:187) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:141) I'm trying to run it with 1.4. thanks Ricardo From taj at www.linux.org.uk Tue Apr 5 00:48:12 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 07:48:12 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42515A83.4050907@emation.pt> References: <42515A83.4050907@emation.pt> Message-ID: On Mon, 4 Apr 2005, Ricardo Trindade wrote: > Hi, > > I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most > recent stable snapshot), and get the following exception : > > It looks like rxtx has been compiled with jdk 1.5. If this was > indeed the case, I think there is a compilation flag that generates code > that runs on older jdks. > > java.lang.UnsupportedClassVersionError: > gnu/io/UnsupportedCommOperationException (Unsupported major.minor > version 49.0) [snip] Thanks Ricardo I recompiled the jar with javac -source 1.3 -target 1.3. That should cover most of the JRE's in use today. I also compiled the rxtx 2.0 x86_64 native library which appeared to be missing. I tried looking for flags to pass gcc 4.0 to make the native libraries more backwards compatible but only found options for C++ which is not used in rxtx. I've got a list of other bugs that I'll be going through in the next few weeks but for now I just left them with the same CVS filename - no code changes. ftp://ftp.qbang.org/pub/rxtx/rxtx-2.0-CVS-20050120-bins.tar.gz ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-CVS-20050120-bins.tar.gz -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Tue Apr 5 02:24:33 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 05 Apr 2005 09:24:33 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: References: <42515A83.4050907@emation.pt> Message-ID: <42524B41.3040300@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050405/5919abbb/attachment-0088.html From taj at www.linux.org.uk Tue Apr 5 03:00:29 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 10:00:29 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42524B41.3040300@emation.pt> References: <42515A83.4050907@emation.pt> <42524B41.3040300@emation.pt> Message-ID: On Tue, 5 Apr 2005, Ricardo Trindade wrote: > Will you anounce to the list when a new release is available ? > There will be several incremental releases announced here. Once those are done, we will release 2.1.7 and 2.0.7. -- Trent Jarvi taj at www.linux.org.uk From no_spam at somewhere.com Tue Apr 5 11:55:37 2005 From: no_spam at somewhere.com (no_spam@somewhere.com) Date: Tue, 5 Apr 2005 13:55:37 -0400 Subject: [Rxtx] Closing a port from an event listener results in a deadlock Message-ID: <20050405175537.GA21747@rcog.homelinux.net> On the message I sent on March 14, does anyone had the chance to try the modification? Or was it already fixed? (I haven't searched the archive extensively) Or maybe my message got catched by some spam filters? (it made it to the list archive though) Anyway, I would appreciate some feedback (through the list) Thanks From taj at www.linux.org.uk Tue Apr 5 14:42:28 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 21:42:28 +0100 (BST) Subject: [Rxtx] Closing a port from an event listener results in a deadlock In-Reply-To: <20050405175537.GA21747@rcog.homelinux.net> References: <20050405175537.GA21747@rcog.homelinux.net> Message-ID: On Tue, 5 Apr 2005 no_spam at somewhere.com wrote: > On the message I sent on March 14, does anyone had the chance to try the > modification? > > Or was it already fixed? (I haven't searched the archive extensively) > > Or maybe my message got catched by some spam filters? (it made it to the list > archive though) > > Anyway, I would appreciate some feedback (through the list) > The patch is here http://marc.theaimsgroup.com/?l=rxtx&m=111084488820288&w=2 I have applied this patch to a local copy but will not be doing formal testing for a couple weeks. I do not try to close ports from inside the eventListenter usually so I encourage any feedback also. If there are no problems reported, I expect this will go into rxtx 2.1-7. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Wed Apr 6 08:33:42 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Wed, 06 Apr 2005 15:33:42 +0100 Subject: [Rxtx] getting RXTX version Message-ID: <4253F346.50102@emation.pt> Hi, I want to make sure my deployments have the same version of RXTX jar and native lib. I know the version of the jar can be obtained in the Version class, but how can I obtain the native version ? I know RXTX prints to the console a warning if the version is different. Is there a way to programatically know is this is the case ? I would like to log that to our app's log thanks Ricardo From taj at www.linux.org.uk Wed Apr 6 15:10:20 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 6 Apr 2005 22:10:20 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4253F346.50102@emation.pt> References: <4253F346.50102@emation.pt> Message-ID: On Wed, 6 Apr 2005, Ricardo Trindade wrote: > Hi, > > I want to make sure my deployments have the same version of RXTX jar > and native lib. > > I know the version of the jar can be obtained in the Version class, > but how can I obtain the native version ? > > I know RXTX prints to the console a warning if the version is > different. Is there a way to programatically know is this is the case ? > > I would like to log that to our app's log > There isn't a suggested way of doing that right now. We could move things around and have a static String RXTXVersion.getNativeVersion() in future releases. Is this what you expected? This is not documented in commapi at all. I just tossed that in to catch conflicts while developing. It would be nice to have access in GUI applications though. It may be possible to access RXTXCommDriver.LibVersion right now. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Thu Apr 7 02:51:00 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 09:51:00 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> Message-ID: <4254F474.7020905@emation.pt> >There isn't a suggested way of doing that right now. We could move things >around and have a static String RXTXVersion.getNativeVersion() in future >releases. Is this what you expected? > > Yes, that would be perfect. >This is not documented in commapi at all. I just tossed that in to catch >conflicts while developing. It would be nice to have access in GUI >applications though. > >It may be possible to access RXTXCommDriver.LibVersion right now. > > > I tried, and I don't think it's possible. From taj at www.linux.org.uk Thu Apr 7 03:32:04 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 7 Apr 2005 10:32:04 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4254F474.7020905@emation.pt> References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: On Thu, 7 Apr 2005, Ricardo Trindade wrote: > > >There isn't a suggested way of doing that right now. We could move things > >around and have a static String RXTXVersion.getNativeVersion() in future > >releases. Is this what you expected? > > > > > > Yes, that would be perfect. > The attached should do what you want. You will still need to catch an exception for older versions... -- Trent Jarvi taj at www.linux.org.uk -------------- next part -------------- ? public_version.patch Index: RXTXCommDriver.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXCommDriver.java,v retrieving revision 1.16.2.51 diff -u -r1.16.2.51 RXTXCommDriver.java --- RXTXCommDriver.java 12 Oct 2004 09:13:30 -0000 1.16.2.51 +++ RXTXCommDriver.java 7 Apr 2005 09:29:04 -0000 @@ -54,7 +54,7 @@ the Library. */ String JarVersion = RXTXVersion.getVersion(); - String LibVersion = nativeGetVersion(); + String LibVersion = RXTXVersion.nativeGetVersion(); if ( devel ) { System.out.println("Devel Library"); @@ -76,7 +76,6 @@ /** Get the Serial port prefixes for the running OS */ private String deviceDirectory; private String osName; - private static native String nativeGetVersion(); private native boolean registerKnownPorts(int PortType); private native boolean isPortPrefixValid(String dev); private native boolean testRead(String dev, int type); Index: RXTXVersion.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXVersion.java,v retrieving revision 1.2.2.31 diff -u -r1.2.2.31 RXTXVersion.java --- RXTXVersion.java 16 Oct 2004 16:20:35 -0000 1.2.2.31 +++ RXTXVersion.java 7 Apr 2005 09:29:04 -0000 @@ -36,6 +36,7 @@ private static String Version; static { + System.loadLibrary( "rxtxSerial" ); Version = "RXTX-2.1-7pre20"; } /** @@ -47,4 +48,5 @@ { return(Version); } + public static native String nativeGetVersion(); } Index: SerialImp.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v retrieving revision 1.46.2.181 diff -u -r1.46.2.181 SerialImp.c --- SerialImp.c 17 Oct 2004 09:48:56 -0000 1.46.2.181 +++ SerialImp.c 7 Apr 2005 09:29:07 -0000 @@ -116,6 +116,7 @@ * It will eventually be removed. * */ #define RXTXPort(foo) Java_gnu_io_RXTXPort_ ## foo +#define RXTXVersion(foo) Java_gnu_io_RXTXVersion_ ## foo #define RXTXCommDriver(foo) Java_gnu_io_RXTXCommDriver_ ## foo #if defined(__sun__) || defined(__hpux__) @@ -4001,7 +4002,7 @@ } /*---------------------------------------------------------- -RXTXCommDriver.nativeGetVersion +RXTXVersion.nativeGetVersion accept: none perform: return the current version @@ -4010,9 +4011,10 @@ comments: This is used to avoid mixing versions of the .jar and native library. First introduced in rxtx-1.5-9 + Moved from RXTXCommDriver to RXTXVersion in rxtx-2.1-7 ----------------------------------------------------------*/ -JNIEXPORT jstring JNICALL RXTXCommDriver(nativeGetVersion) (JNIEnv *env, +JNIEXPORT jstring JNICALL RXTXVersion(nativeGetVersion) (JNIEnv *env, jclass jclazz ) { return (*env)->NewStringUTF( env, "RXTX-2.1-7pre20" ); From ricardo.trindade at emation.pt Thu Apr 7 03:45:58 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 10:45:58 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: <42550156.2040908@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050407/05212451/attachment-0088.html From thomas.shulok at lmco.com Thu Apr 7 17:43:11 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Thu, 07 Apr 2005 19:43:11 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi There, I'm attempting to talk RS232 between an embedded Linux box and a Windows box. Everything connects up fine, and I can send and receive a simple sequence of bytes with no problems. However, if around 5 seconds goes by without me sending something, I get the following when I attempt to send. java.io.IOException: Input/output error in writeArray Stack trace: java/lang/Throwable.()V java/lang/Throwable.(Ljava/lang/String;)V java/io/IOException.(Ljava/lang/String;)V gnu/io/RXTXPort.writeArray([BIIZ)V gnu/io/RXTXPort$SerialOutputStream.write([B)V SerialTest.main([Ljava/lang/String;)V If there interval is shorter (say 2 seconds between sends), I have no problems. On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and librxtxSerial-2.0.7pre2.so. Any ideas? Thanks, Thom -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5b23dcf/attachment-0088.html From taj at www.linux.org.uk Thu Apr 7 19:22:36 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:22:36 +0100 (BST) Subject: [Rxtx] Input/output error in writeArray In-Reply-To: References: Message-ID: On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a Windows > box. Everything connects up fine, and I can send and receive a simple > sequence of bytes with no problems. However, if around 5 seconds goes > by without me sending something, I get the following when I attempt to > send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Apr 7 19:24:59 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:24:59 +0100 (BST) Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) Message-ID: hmm. This would not work from applets would it? -- Trent Jarvi taj at www.linux.org.uk ---------- Forwarded message ---------- Date: Thu, 07 Apr 2005 16:05:53 -0400 From: Chris Gaffney To: taj at www.linux.org.uk Subject: RXTX Libraries on Classpath fix Hi, I submitted a patch for RXTX a few weeks ago to allow for loading the native libraries from the classpath. Since sending it to you I found it wasn't working on windows. I've fixed the problem and created a new patch that should replace the older one. The actual change is a one line from a String.equals() to a String.startsWith(). Thanks for a great piece of software, -Chris Gaffney Grand Valley State University -------------- next part -------------- A non-text attachment was scrubbed... Name: libraries_on_classpath_fixed.patch Type: text/x-patch Size: 5617 bytes Desc: Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5d423b8/libraries_on_classpath_fixed-0088.bin From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From thomas.shulok at lmco.com Fri Apr 8 10:38:55 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Fri, 08 Apr 2005 12:38:55 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi Trent, Thanks for the prompt response. Before diving deeper, I was wondering if there is a timeout parameter somewhere in the stack that I have not set properly. Given the nature of the failure (only fails if the line has been idle for a few seconds), it feels like some kind of timeout issue... Thanks again, Thom -----Original Message----- From: rxtx-bounces at mail.linuxgrrls.org [mailto:rxtx-bounces at mail.linuxgrrls.org] On Behalf Of Trent Jarvi Sent: Thursday, April 07, 2005 6:23 PM To: Java RXTX discussion Subject: Re: [Rxtx] Input/output error in writeArray On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a > Windows box. Everything connects up fine, and I can send and receive > a simple sequence of bytes with no problems. However, if around 5 > seconds goes by without me sending something, I get the following when > I attempt to send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at mail.linuxgrrls.org http://mail.linuxgrrls.org/mailman/listinfo/rxtx From ricardo.trindade at emation.pt Mon Apr 4 09:17:23 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Mon, 04 Apr 2005 16:17:23 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot Message-ID: <42515A83.4050907@emation.pt> Hi, I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most recent stable snapshot), and get the following exception : It looks like rxtx has been compiled with jdk 1.5. If this was indeed the case, I think there is a compilation flag that generates code that runs on older jdks. java.lang.UnsupportedClassVersionError: gnu/io/UnsupportedCommOperationException (Unsupported major.minor version 49.0) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at java.net.URLClassLoader.defineClass(URLClassLoader.java:251) at java.net.URLClassLoader.access$100(URLClassLoader.java:55) at java.net.URLClassLoader$1.run(URLClassLoader.java:194) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:187) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:141) I'm trying to run it with 1.4. thanks Ricardo From taj at www.linux.org.uk Tue Apr 5 00:48:12 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 07:48:12 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42515A83.4050907@emation.pt> References: <42515A83.4050907@emation.pt> Message-ID: On Mon, 4 Apr 2005, Ricardo Trindade wrote: > Hi, > > I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most > recent stable snapshot), and get the following exception : > > It looks like rxtx has been compiled with jdk 1.5. If this was > indeed the case, I think there is a compilation flag that generates code > that runs on older jdks. > > java.lang.UnsupportedClassVersionError: > gnu/io/UnsupportedCommOperationException (Unsupported major.minor > version 49.0) [snip] Thanks Ricardo I recompiled the jar with javac -source 1.3 -target 1.3. That should cover most of the JRE's in use today. I also compiled the rxtx 2.0 x86_64 native library which appeared to be missing. I tried looking for flags to pass gcc 4.0 to make the native libraries more backwards compatible but only found options for C++ which is not used in rxtx. I've got a list of other bugs that I'll be going through in the next few weeks but for now I just left them with the same CVS filename - no code changes. ftp://ftp.qbang.org/pub/rxtx/rxtx-2.0-CVS-20050120-bins.tar.gz ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-CVS-20050120-bins.tar.gz -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Tue Apr 5 02:24:33 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 05 Apr 2005 09:24:33 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: References: <42515A83.4050907@emation.pt> Message-ID: <42524B41.3040300@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050405/5919abbb/attachment-0089.html From taj at www.linux.org.uk Tue Apr 5 03:00:29 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 10:00:29 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42524B41.3040300@emation.pt> References: <42515A83.4050907@emation.pt> <42524B41.3040300@emation.pt> Message-ID: On Tue, 5 Apr 2005, Ricardo Trindade wrote: > Will you anounce to the list when a new release is available ? > There will be several incremental releases announced here. Once those are done, we will release 2.1.7 and 2.0.7. -- Trent Jarvi taj at www.linux.org.uk From no_spam at somewhere.com Tue Apr 5 11:55:37 2005 From: no_spam at somewhere.com (no_spam@somewhere.com) Date: Tue, 5 Apr 2005 13:55:37 -0400 Subject: [Rxtx] Closing a port from an event listener results in a deadlock Message-ID: <20050405175537.GA21747@rcog.homelinux.net> On the message I sent on March 14, does anyone had the chance to try the modification? Or was it already fixed? (I haven't searched the archive extensively) Or maybe my message got catched by some spam filters? (it made it to the list archive though) Anyway, I would appreciate some feedback (through the list) Thanks From taj at www.linux.org.uk Tue Apr 5 14:42:28 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 21:42:28 +0100 (BST) Subject: [Rxtx] Closing a port from an event listener results in a deadlock In-Reply-To: <20050405175537.GA21747@rcog.homelinux.net> References: <20050405175537.GA21747@rcog.homelinux.net> Message-ID: On Tue, 5 Apr 2005 no_spam at somewhere.com wrote: > On the message I sent on March 14, does anyone had the chance to try the > modification? > > Or was it already fixed? (I haven't searched the archive extensively) > > Or maybe my message got catched by some spam filters? (it made it to the list > archive though) > > Anyway, I would appreciate some feedback (through the list) > The patch is here http://marc.theaimsgroup.com/?l=rxtx&m=111084488820288&w=2 I have applied this patch to a local copy but will not be doing formal testing for a couple weeks. I do not try to close ports from inside the eventListenter usually so I encourage any feedback also. If there are no problems reported, I expect this will go into rxtx 2.1-7. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Wed Apr 6 08:33:42 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Wed, 06 Apr 2005 15:33:42 +0100 Subject: [Rxtx] getting RXTX version Message-ID: <4253F346.50102@emation.pt> Hi, I want to make sure my deployments have the same version of RXTX jar and native lib. I know the version of the jar can be obtained in the Version class, but how can I obtain the native version ? I know RXTX prints to the console a warning if the version is different. Is there a way to programatically know is this is the case ? I would like to log that to our app's log thanks Ricardo From taj at www.linux.org.uk Wed Apr 6 15:10:20 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 6 Apr 2005 22:10:20 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4253F346.50102@emation.pt> References: <4253F346.50102@emation.pt> Message-ID: On Wed, 6 Apr 2005, Ricardo Trindade wrote: > Hi, > > I want to make sure my deployments have the same version of RXTX jar > and native lib. > > I know the version of the jar can be obtained in the Version class, > but how can I obtain the native version ? > > I know RXTX prints to the console a warning if the version is > different. Is there a way to programatically know is this is the case ? > > I would like to log that to our app's log > There isn't a suggested way of doing that right now. We could move things around and have a static String RXTXVersion.getNativeVersion() in future releases. Is this what you expected? This is not documented in commapi at all. I just tossed that in to catch conflicts while developing. It would be nice to have access in GUI applications though. It may be possible to access RXTXCommDriver.LibVersion right now. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Thu Apr 7 02:51:00 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 09:51:00 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> Message-ID: <4254F474.7020905@emation.pt> >There isn't a suggested way of doing that right now. We could move things >around and have a static String RXTXVersion.getNativeVersion() in future >releases. Is this what you expected? > > Yes, that would be perfect. >This is not documented in commapi at all. I just tossed that in to catch >conflicts while developing. It would be nice to have access in GUI >applications though. > >It may be possible to access RXTXCommDriver.LibVersion right now. > > > I tried, and I don't think it's possible. From taj at www.linux.org.uk Thu Apr 7 03:32:04 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 7 Apr 2005 10:32:04 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4254F474.7020905@emation.pt> References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: On Thu, 7 Apr 2005, Ricardo Trindade wrote: > > >There isn't a suggested way of doing that right now. We could move things > >around and have a static String RXTXVersion.getNativeVersion() in future > >releases. Is this what you expected? > > > > > > Yes, that would be perfect. > The attached should do what you want. You will still need to catch an exception for older versions... -- Trent Jarvi taj at www.linux.org.uk -------------- next part -------------- ? public_version.patch Index: RXTXCommDriver.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXCommDriver.java,v retrieving revision 1.16.2.51 diff -u -r1.16.2.51 RXTXCommDriver.java --- RXTXCommDriver.java 12 Oct 2004 09:13:30 -0000 1.16.2.51 +++ RXTXCommDriver.java 7 Apr 2005 09:29:04 -0000 @@ -54,7 +54,7 @@ the Library. */ String JarVersion = RXTXVersion.getVersion(); - String LibVersion = nativeGetVersion(); + String LibVersion = RXTXVersion.nativeGetVersion(); if ( devel ) { System.out.println("Devel Library"); @@ -76,7 +76,6 @@ /** Get the Serial port prefixes for the running OS */ private String deviceDirectory; private String osName; - private static native String nativeGetVersion(); private native boolean registerKnownPorts(int PortType); private native boolean isPortPrefixValid(String dev); private native boolean testRead(String dev, int type); Index: RXTXVersion.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXVersion.java,v retrieving revision 1.2.2.31 diff -u -r1.2.2.31 RXTXVersion.java --- RXTXVersion.java 16 Oct 2004 16:20:35 -0000 1.2.2.31 +++ RXTXVersion.java 7 Apr 2005 09:29:04 -0000 @@ -36,6 +36,7 @@ private static String Version; static { + System.loadLibrary( "rxtxSerial" ); Version = "RXTX-2.1-7pre20"; } /** @@ -47,4 +48,5 @@ { return(Version); } + public static native String nativeGetVersion(); } Index: SerialImp.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v retrieving revision 1.46.2.181 diff -u -r1.46.2.181 SerialImp.c --- SerialImp.c 17 Oct 2004 09:48:56 -0000 1.46.2.181 +++ SerialImp.c 7 Apr 2005 09:29:07 -0000 @@ -116,6 +116,7 @@ * It will eventually be removed. * */ #define RXTXPort(foo) Java_gnu_io_RXTXPort_ ## foo +#define RXTXVersion(foo) Java_gnu_io_RXTXVersion_ ## foo #define RXTXCommDriver(foo) Java_gnu_io_RXTXCommDriver_ ## foo #if defined(__sun__) || defined(__hpux__) @@ -4001,7 +4002,7 @@ } /*---------------------------------------------------------- -RXTXCommDriver.nativeGetVersion +RXTXVersion.nativeGetVersion accept: none perform: return the current version @@ -4010,9 +4011,10 @@ comments: This is used to avoid mixing versions of the .jar and native library. First introduced in rxtx-1.5-9 + Moved from RXTXCommDriver to RXTXVersion in rxtx-2.1-7 ----------------------------------------------------------*/ -JNIEXPORT jstring JNICALL RXTXCommDriver(nativeGetVersion) (JNIEnv *env, +JNIEXPORT jstring JNICALL RXTXVersion(nativeGetVersion) (JNIEnv *env, jclass jclazz ) { return (*env)->NewStringUTF( env, "RXTX-2.1-7pre20" ); From ricardo.trindade at emation.pt Thu Apr 7 03:45:58 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 10:45:58 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: <42550156.2040908@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050407/05212451/attachment-0089.html From thomas.shulok at lmco.com Thu Apr 7 17:43:11 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Thu, 07 Apr 2005 19:43:11 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi There, I'm attempting to talk RS232 between an embedded Linux box and a Windows box. Everything connects up fine, and I can send and receive a simple sequence of bytes with no problems. However, if around 5 seconds goes by without me sending something, I get the following when I attempt to send. java.io.IOException: Input/output error in writeArray Stack trace: java/lang/Throwable.()V java/lang/Throwable.(Ljava/lang/String;)V java/io/IOException.(Ljava/lang/String;)V gnu/io/RXTXPort.writeArray([BIIZ)V gnu/io/RXTXPort$SerialOutputStream.write([B)V SerialTest.main([Ljava/lang/String;)V If there interval is shorter (say 2 seconds between sends), I have no problems. On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and librxtxSerial-2.0.7pre2.so. Any ideas? Thanks, Thom -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5b23dcf/attachment-0089.html From taj at www.linux.org.uk Thu Apr 7 19:22:36 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:22:36 +0100 (BST) Subject: [Rxtx] Input/output error in writeArray In-Reply-To: References: Message-ID: On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a Windows > box. Everything connects up fine, and I can send and receive a simple > sequence of bytes with no problems. However, if around 5 seconds goes > by without me sending something, I get the following when I attempt to > send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Apr 7 19:24:59 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:24:59 +0100 (BST) Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) Message-ID: hmm. This would not work from applets would it? -- Trent Jarvi taj at www.linux.org.uk ---------- Forwarded message ---------- Date: Thu, 07 Apr 2005 16:05:53 -0400 From: Chris Gaffney To: taj at www.linux.org.uk Subject: RXTX Libraries on Classpath fix Hi, I submitted a patch for RXTX a few weeks ago to allow for loading the native libraries from the classpath. Since sending it to you I found it wasn't working on windows. I've fixed the problem and created a new patch that should replace the older one. The actual change is a one line from a String.equals() to a String.startsWith(). Thanks for a great piece of software, -Chris Gaffney Grand Valley State University -------------- next part -------------- A non-text attachment was scrubbed... Name: libraries_on_classpath_fixed.patch Type: text/x-patch Size: 5617 bytes Desc: Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5d423b8/libraries_on_classpath_fixed-0089.bin From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From thomas.shulok at lmco.com Fri Apr 8 10:38:55 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Fri, 08 Apr 2005 12:38:55 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi Trent, Thanks for the prompt response. Before diving deeper, I was wondering if there is a timeout parameter somewhere in the stack that I have not set properly. Given the nature of the failure (only fails if the line has been idle for a few seconds), it feels like some kind of timeout issue... Thanks again, Thom -----Original Message----- From: rxtx-bounces at mail.linuxgrrls.org [mailto:rxtx-bounces at mail.linuxgrrls.org] On Behalf Of Trent Jarvi Sent: Thursday, April 07, 2005 6:23 PM To: Java RXTX discussion Subject: Re: [Rxtx] Input/output error in writeArray On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a > Windows box. Everything connects up fine, and I can send and receive > a simple sequence of bytes with no problems. However, if around 5 > seconds goes by without me sending something, I get the following when > I attempt to send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at mail.linuxgrrls.org http://mail.linuxgrrls.org/mailman/listinfo/rxtx From ricardo.trindade at emation.pt Mon Apr 4 09:17:23 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Mon, 04 Apr 2005 16:17:23 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot Message-ID: <42515A83.4050907@emation.pt> Hi, I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most recent stable snapshot), and get the following exception : It looks like rxtx has been compiled with jdk 1.5. If this was indeed the case, I think there is a compilation flag that generates code that runs on older jdks. java.lang.UnsupportedClassVersionError: gnu/io/UnsupportedCommOperationException (Unsupported major.minor version 49.0) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at java.net.URLClassLoader.defineClass(URLClassLoader.java:251) at java.net.URLClassLoader.access$100(URLClassLoader.java:55) at java.net.URLClassLoader$1.run(URLClassLoader.java:194) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:187) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:141) I'm trying to run it with 1.4. thanks Ricardo From taj at www.linux.org.uk Tue Apr 5 00:48:12 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 07:48:12 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42515A83.4050907@emation.pt> References: <42515A83.4050907@emation.pt> Message-ID: On Mon, 4 Apr 2005, Ricardo Trindade wrote: > Hi, > > I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most > recent stable snapshot), and get the following exception : > > It looks like rxtx has been compiled with jdk 1.5. If this was > indeed the case, I think there is a compilation flag that generates code > that runs on older jdks. > > java.lang.UnsupportedClassVersionError: > gnu/io/UnsupportedCommOperationException (Unsupported major.minor > version 49.0) [snip] Thanks Ricardo I recompiled the jar with javac -source 1.3 -target 1.3. That should cover most of the JRE's in use today. I also compiled the rxtx 2.0 x86_64 native library which appeared to be missing. I tried looking for flags to pass gcc 4.0 to make the native libraries more backwards compatible but only found options for C++ which is not used in rxtx. I've got a list of other bugs that I'll be going through in the next few weeks but for now I just left them with the same CVS filename - no code changes. ftp://ftp.qbang.org/pub/rxtx/rxtx-2.0-CVS-20050120-bins.tar.gz ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-CVS-20050120-bins.tar.gz -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Tue Apr 5 02:24:33 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 05 Apr 2005 09:24:33 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: References: <42515A83.4050907@emation.pt> Message-ID: <42524B41.3040300@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050405/5919abbb/attachment-0090.html From taj at www.linux.org.uk Tue Apr 5 03:00:29 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 10:00:29 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42524B41.3040300@emation.pt> References: <42515A83.4050907@emation.pt> <42524B41.3040300@emation.pt> Message-ID: On Tue, 5 Apr 2005, Ricardo Trindade wrote: > Will you anounce to the list when a new release is available ? > There will be several incremental releases announced here. Once those are done, we will release 2.1.7 and 2.0.7. -- Trent Jarvi taj at www.linux.org.uk From no_spam at somewhere.com Tue Apr 5 11:55:37 2005 From: no_spam at somewhere.com (no_spam@somewhere.com) Date: Tue, 5 Apr 2005 13:55:37 -0400 Subject: [Rxtx] Closing a port from an event listener results in a deadlock Message-ID: <20050405175537.GA21747@rcog.homelinux.net> On the message I sent on March 14, does anyone had the chance to try the modification? Or was it already fixed? (I haven't searched the archive extensively) Or maybe my message got catched by some spam filters? (it made it to the list archive though) Anyway, I would appreciate some feedback (through the list) Thanks From taj at www.linux.org.uk Tue Apr 5 14:42:28 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 21:42:28 +0100 (BST) Subject: [Rxtx] Closing a port from an event listener results in a deadlock In-Reply-To: <20050405175537.GA21747@rcog.homelinux.net> References: <20050405175537.GA21747@rcog.homelinux.net> Message-ID: On Tue, 5 Apr 2005 no_spam at somewhere.com wrote: > On the message I sent on March 14, does anyone had the chance to try the > modification? > > Or was it already fixed? (I haven't searched the archive extensively) > > Or maybe my message got catched by some spam filters? (it made it to the list > archive though) > > Anyway, I would appreciate some feedback (through the list) > The patch is here http://marc.theaimsgroup.com/?l=rxtx&m=111084488820288&w=2 I have applied this patch to a local copy but will not be doing formal testing for a couple weeks. I do not try to close ports from inside the eventListenter usually so I encourage any feedback also. If there are no problems reported, I expect this will go into rxtx 2.1-7. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Wed Apr 6 08:33:42 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Wed, 06 Apr 2005 15:33:42 +0100 Subject: [Rxtx] getting RXTX version Message-ID: <4253F346.50102@emation.pt> Hi, I want to make sure my deployments have the same version of RXTX jar and native lib. I know the version of the jar can be obtained in the Version class, but how can I obtain the native version ? I know RXTX prints to the console a warning if the version is different. Is there a way to programatically know is this is the case ? I would like to log that to our app's log thanks Ricardo From taj at www.linux.org.uk Wed Apr 6 15:10:20 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 6 Apr 2005 22:10:20 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4253F346.50102@emation.pt> References: <4253F346.50102@emation.pt> Message-ID: On Wed, 6 Apr 2005, Ricardo Trindade wrote: > Hi, > > I want to make sure my deployments have the same version of RXTX jar > and native lib. > > I know the version of the jar can be obtained in the Version class, > but how can I obtain the native version ? > > I know RXTX prints to the console a warning if the version is > different. Is there a way to programatically know is this is the case ? > > I would like to log that to our app's log > There isn't a suggested way of doing that right now. We could move things around and have a static String RXTXVersion.getNativeVersion() in future releases. Is this what you expected? This is not documented in commapi at all. I just tossed that in to catch conflicts while developing. It would be nice to have access in GUI applications though. It may be possible to access RXTXCommDriver.LibVersion right now. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Thu Apr 7 02:51:00 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 09:51:00 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> Message-ID: <4254F474.7020905@emation.pt> >There isn't a suggested way of doing that right now. We could move things >around and have a static String RXTXVersion.getNativeVersion() in future >releases. Is this what you expected? > > Yes, that would be perfect. >This is not documented in commapi at all. I just tossed that in to catch >conflicts while developing. It would be nice to have access in GUI >applications though. > >It may be possible to access RXTXCommDriver.LibVersion right now. > > > I tried, and I don't think it's possible. From taj at www.linux.org.uk Thu Apr 7 03:32:04 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 7 Apr 2005 10:32:04 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4254F474.7020905@emation.pt> References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: On Thu, 7 Apr 2005, Ricardo Trindade wrote: > > >There isn't a suggested way of doing that right now. We could move things > >around and have a static String RXTXVersion.getNativeVersion() in future > >releases. Is this what you expected? > > > > > > Yes, that would be perfect. > The attached should do what you want. You will still need to catch an exception for older versions... -- Trent Jarvi taj at www.linux.org.uk -------------- next part -------------- ? public_version.patch Index: RXTXCommDriver.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXCommDriver.java,v retrieving revision 1.16.2.51 diff -u -r1.16.2.51 RXTXCommDriver.java --- RXTXCommDriver.java 12 Oct 2004 09:13:30 -0000 1.16.2.51 +++ RXTXCommDriver.java 7 Apr 2005 09:29:04 -0000 @@ -54,7 +54,7 @@ the Library. */ String JarVersion = RXTXVersion.getVersion(); - String LibVersion = nativeGetVersion(); + String LibVersion = RXTXVersion.nativeGetVersion(); if ( devel ) { System.out.println("Devel Library"); @@ -76,7 +76,6 @@ /** Get the Serial port prefixes for the running OS */ private String deviceDirectory; private String osName; - private static native String nativeGetVersion(); private native boolean registerKnownPorts(int PortType); private native boolean isPortPrefixValid(String dev); private native boolean testRead(String dev, int type); Index: RXTXVersion.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXVersion.java,v retrieving revision 1.2.2.31 diff -u -r1.2.2.31 RXTXVersion.java --- RXTXVersion.java 16 Oct 2004 16:20:35 -0000 1.2.2.31 +++ RXTXVersion.java 7 Apr 2005 09:29:04 -0000 @@ -36,6 +36,7 @@ private static String Version; static { + System.loadLibrary( "rxtxSerial" ); Version = "RXTX-2.1-7pre20"; } /** @@ -47,4 +48,5 @@ { return(Version); } + public static native String nativeGetVersion(); } Index: SerialImp.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v retrieving revision 1.46.2.181 diff -u -r1.46.2.181 SerialImp.c --- SerialImp.c 17 Oct 2004 09:48:56 -0000 1.46.2.181 +++ SerialImp.c 7 Apr 2005 09:29:07 -0000 @@ -116,6 +116,7 @@ * It will eventually be removed. * */ #define RXTXPort(foo) Java_gnu_io_RXTXPort_ ## foo +#define RXTXVersion(foo) Java_gnu_io_RXTXVersion_ ## foo #define RXTXCommDriver(foo) Java_gnu_io_RXTXCommDriver_ ## foo #if defined(__sun__) || defined(__hpux__) @@ -4001,7 +4002,7 @@ } /*---------------------------------------------------------- -RXTXCommDriver.nativeGetVersion +RXTXVersion.nativeGetVersion accept: none perform: return the current version @@ -4010,9 +4011,10 @@ comments: This is used to avoid mixing versions of the .jar and native library. First introduced in rxtx-1.5-9 + Moved from RXTXCommDriver to RXTXVersion in rxtx-2.1-7 ----------------------------------------------------------*/ -JNIEXPORT jstring JNICALL RXTXCommDriver(nativeGetVersion) (JNIEnv *env, +JNIEXPORT jstring JNICALL RXTXVersion(nativeGetVersion) (JNIEnv *env, jclass jclazz ) { return (*env)->NewStringUTF( env, "RXTX-2.1-7pre20" ); From ricardo.trindade at emation.pt Thu Apr 7 03:45:58 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 10:45:58 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: <42550156.2040908@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050407/05212451/attachment-0090.html From thomas.shulok at lmco.com Thu Apr 7 17:43:11 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Thu, 07 Apr 2005 19:43:11 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi There, I'm attempting to talk RS232 between an embedded Linux box and a Windows box. Everything connects up fine, and I can send and receive a simple sequence of bytes with no problems. However, if around 5 seconds goes by without me sending something, I get the following when I attempt to send. java.io.IOException: Input/output error in writeArray Stack trace: java/lang/Throwable.()V java/lang/Throwable.(Ljava/lang/String;)V java/io/IOException.(Ljava/lang/String;)V gnu/io/RXTXPort.writeArray([BIIZ)V gnu/io/RXTXPort$SerialOutputStream.write([B)V SerialTest.main([Ljava/lang/String;)V If there interval is shorter (say 2 seconds between sends), I have no problems. On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and librxtxSerial-2.0.7pre2.so. Any ideas? Thanks, Thom -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5b23dcf/attachment-0090.html From taj at www.linux.org.uk Thu Apr 7 19:22:36 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:22:36 +0100 (BST) Subject: [Rxtx] Input/output error in writeArray In-Reply-To: References: Message-ID: On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a Windows > box. Everything connects up fine, and I can send and receive a simple > sequence of bytes with no problems. However, if around 5 seconds goes > by without me sending something, I get the following when I attempt to > send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Apr 7 19:24:59 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:24:59 +0100 (BST) Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) Message-ID: hmm. This would not work from applets would it? -- Trent Jarvi taj at www.linux.org.uk ---------- Forwarded message ---------- Date: Thu, 07 Apr 2005 16:05:53 -0400 From: Chris Gaffney To: taj at www.linux.org.uk Subject: RXTX Libraries on Classpath fix Hi, I submitted a patch for RXTX a few weeks ago to allow for loading the native libraries from the classpath. Since sending it to you I found it wasn't working on windows. I've fixed the problem and created a new patch that should replace the older one. The actual change is a one line from a String.equals() to a String.startsWith(). Thanks for a great piece of software, -Chris Gaffney Grand Valley State University -------------- next part -------------- A non-text attachment was scrubbed... Name: libraries_on_classpath_fixed.patch Type: text/x-patch Size: 5617 bytes Desc: Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5d423b8/libraries_on_classpath_fixed-0090.bin From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From thomas.shulok at lmco.com Fri Apr 8 10:38:55 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Fri, 08 Apr 2005 12:38:55 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi Trent, Thanks for the prompt response. Before diving deeper, I was wondering if there is a timeout parameter somewhere in the stack that I have not set properly. Given the nature of the failure (only fails if the line has been idle for a few seconds), it feels like some kind of timeout issue... Thanks again, Thom -----Original Message----- From: rxtx-bounces at mail.linuxgrrls.org [mailto:rxtx-bounces at mail.linuxgrrls.org] On Behalf Of Trent Jarvi Sent: Thursday, April 07, 2005 6:23 PM To: Java RXTX discussion Subject: Re: [Rxtx] Input/output error in writeArray On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a > Windows box. Everything connects up fine, and I can send and receive > a simple sequence of bytes with no problems. However, if around 5 > seconds goes by without me sending something, I get the following when > I attempt to send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at mail.linuxgrrls.org http://mail.linuxgrrls.org/mailman/listinfo/rxtx From ricardo.trindade at emation.pt Mon Apr 4 09:17:23 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Mon, 04 Apr 2005 16:17:23 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot Message-ID: <42515A83.4050907@emation.pt> Hi, I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most recent stable snapshot), and get the following exception : It looks like rxtx has been compiled with jdk 1.5. If this was indeed the case, I think there is a compilation flag that generates code that runs on older jdks. java.lang.UnsupportedClassVersionError: gnu/io/UnsupportedCommOperationException (Unsupported major.minor version 49.0) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at java.net.URLClassLoader.defineClass(URLClassLoader.java:251) at java.net.URLClassLoader.access$100(URLClassLoader.java:55) at java.net.URLClassLoader$1.run(URLClassLoader.java:194) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:187) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:141) I'm trying to run it with 1.4. thanks Ricardo From taj at www.linux.org.uk Tue Apr 5 00:48:12 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 07:48:12 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42515A83.4050907@emation.pt> References: <42515A83.4050907@emation.pt> Message-ID: On Mon, 4 Apr 2005, Ricardo Trindade wrote: > Hi, > > I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most > recent stable snapshot), and get the following exception : > > It looks like rxtx has been compiled with jdk 1.5. If this was > indeed the case, I think there is a compilation flag that generates code > that runs on older jdks. > > java.lang.UnsupportedClassVersionError: > gnu/io/UnsupportedCommOperationException (Unsupported major.minor > version 49.0) [snip] Thanks Ricardo I recompiled the jar with javac -source 1.3 -target 1.3. That should cover most of the JRE's in use today. I also compiled the rxtx 2.0 x86_64 native library which appeared to be missing. I tried looking for flags to pass gcc 4.0 to make the native libraries more backwards compatible but only found options for C++ which is not used in rxtx. I've got a list of other bugs that I'll be going through in the next few weeks but for now I just left them with the same CVS filename - no code changes. ftp://ftp.qbang.org/pub/rxtx/rxtx-2.0-CVS-20050120-bins.tar.gz ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-CVS-20050120-bins.tar.gz -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Tue Apr 5 02:24:33 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 05 Apr 2005 09:24:33 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: References: <42515A83.4050907@emation.pt> Message-ID: <42524B41.3040300@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050405/5919abbb/attachment-0091.html From taj at www.linux.org.uk Tue Apr 5 03:00:29 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 10:00:29 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42524B41.3040300@emation.pt> References: <42515A83.4050907@emation.pt> <42524B41.3040300@emation.pt> Message-ID: On Tue, 5 Apr 2005, Ricardo Trindade wrote: > Will you anounce to the list when a new release is available ? > There will be several incremental releases announced here. Once those are done, we will release 2.1.7 and 2.0.7. -- Trent Jarvi taj at www.linux.org.uk From no_spam at somewhere.com Tue Apr 5 11:55:37 2005 From: no_spam at somewhere.com (no_spam@somewhere.com) Date: Tue, 5 Apr 2005 13:55:37 -0400 Subject: [Rxtx] Closing a port from an event listener results in a deadlock Message-ID: <20050405175537.GA21747@rcog.homelinux.net> On the message I sent on March 14, does anyone had the chance to try the modification? Or was it already fixed? (I haven't searched the archive extensively) Or maybe my message got catched by some spam filters? (it made it to the list archive though) Anyway, I would appreciate some feedback (through the list) Thanks From taj at www.linux.org.uk Tue Apr 5 14:42:28 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 21:42:28 +0100 (BST) Subject: [Rxtx] Closing a port from an event listener results in a deadlock In-Reply-To: <20050405175537.GA21747@rcog.homelinux.net> References: <20050405175537.GA21747@rcog.homelinux.net> Message-ID: On Tue, 5 Apr 2005 no_spam at somewhere.com wrote: > On the message I sent on March 14, does anyone had the chance to try the > modification? > > Or was it already fixed? (I haven't searched the archive extensively) > > Or maybe my message got catched by some spam filters? (it made it to the list > archive though) > > Anyway, I would appreciate some feedback (through the list) > The patch is here http://marc.theaimsgroup.com/?l=rxtx&m=111084488820288&w=2 I have applied this patch to a local copy but will not be doing formal testing for a couple weeks. I do not try to close ports from inside the eventListenter usually so I encourage any feedback also. If there are no problems reported, I expect this will go into rxtx 2.1-7. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Wed Apr 6 08:33:42 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Wed, 06 Apr 2005 15:33:42 +0100 Subject: [Rxtx] getting RXTX version Message-ID: <4253F346.50102@emation.pt> Hi, I want to make sure my deployments have the same version of RXTX jar and native lib. I know the version of the jar can be obtained in the Version class, but how can I obtain the native version ? I know RXTX prints to the console a warning if the version is different. Is there a way to programatically know is this is the case ? I would like to log that to our app's log thanks Ricardo From taj at www.linux.org.uk Wed Apr 6 15:10:20 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 6 Apr 2005 22:10:20 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4253F346.50102@emation.pt> References: <4253F346.50102@emation.pt> Message-ID: On Wed, 6 Apr 2005, Ricardo Trindade wrote: > Hi, > > I want to make sure my deployments have the same version of RXTX jar > and native lib. > > I know the version of the jar can be obtained in the Version class, > but how can I obtain the native version ? > > I know RXTX prints to the console a warning if the version is > different. Is there a way to programatically know is this is the case ? > > I would like to log that to our app's log > There isn't a suggested way of doing that right now. We could move things around and have a static String RXTXVersion.getNativeVersion() in future releases. Is this what you expected? This is not documented in commapi at all. I just tossed that in to catch conflicts while developing. It would be nice to have access in GUI applications though. It may be possible to access RXTXCommDriver.LibVersion right now. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Thu Apr 7 02:51:00 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 09:51:00 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> Message-ID: <4254F474.7020905@emation.pt> >There isn't a suggested way of doing that right now. We could move things >around and have a static String RXTXVersion.getNativeVersion() in future >releases. Is this what you expected? > > Yes, that would be perfect. >This is not documented in commapi at all. I just tossed that in to catch >conflicts while developing. It would be nice to have access in GUI >applications though. > >It may be possible to access RXTXCommDriver.LibVersion right now. > > > I tried, and I don't think it's possible. From taj at www.linux.org.uk Thu Apr 7 03:32:04 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 7 Apr 2005 10:32:04 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4254F474.7020905@emation.pt> References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: On Thu, 7 Apr 2005, Ricardo Trindade wrote: > > >There isn't a suggested way of doing that right now. We could move things > >around and have a static String RXTXVersion.getNativeVersion() in future > >releases. Is this what you expected? > > > > > > Yes, that would be perfect. > The attached should do what you want. You will still need to catch an exception for older versions... -- Trent Jarvi taj at www.linux.org.uk -------------- next part -------------- ? public_version.patch Index: RXTXCommDriver.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXCommDriver.java,v retrieving revision 1.16.2.51 diff -u -r1.16.2.51 RXTXCommDriver.java --- RXTXCommDriver.java 12 Oct 2004 09:13:30 -0000 1.16.2.51 +++ RXTXCommDriver.java 7 Apr 2005 09:29:04 -0000 @@ -54,7 +54,7 @@ the Library. */ String JarVersion = RXTXVersion.getVersion(); - String LibVersion = nativeGetVersion(); + String LibVersion = RXTXVersion.nativeGetVersion(); if ( devel ) { System.out.println("Devel Library"); @@ -76,7 +76,6 @@ /** Get the Serial port prefixes for the running OS */ private String deviceDirectory; private String osName; - private static native String nativeGetVersion(); private native boolean registerKnownPorts(int PortType); private native boolean isPortPrefixValid(String dev); private native boolean testRead(String dev, int type); Index: RXTXVersion.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXVersion.java,v retrieving revision 1.2.2.31 diff -u -r1.2.2.31 RXTXVersion.java --- RXTXVersion.java 16 Oct 2004 16:20:35 -0000 1.2.2.31 +++ RXTXVersion.java 7 Apr 2005 09:29:04 -0000 @@ -36,6 +36,7 @@ private static String Version; static { + System.loadLibrary( "rxtxSerial" ); Version = "RXTX-2.1-7pre20"; } /** @@ -47,4 +48,5 @@ { return(Version); } + public static native String nativeGetVersion(); } Index: SerialImp.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v retrieving revision 1.46.2.181 diff -u -r1.46.2.181 SerialImp.c --- SerialImp.c 17 Oct 2004 09:48:56 -0000 1.46.2.181 +++ SerialImp.c 7 Apr 2005 09:29:07 -0000 @@ -116,6 +116,7 @@ * It will eventually be removed. * */ #define RXTXPort(foo) Java_gnu_io_RXTXPort_ ## foo +#define RXTXVersion(foo) Java_gnu_io_RXTXVersion_ ## foo #define RXTXCommDriver(foo) Java_gnu_io_RXTXCommDriver_ ## foo #if defined(__sun__) || defined(__hpux__) @@ -4001,7 +4002,7 @@ } /*---------------------------------------------------------- -RXTXCommDriver.nativeGetVersion +RXTXVersion.nativeGetVersion accept: none perform: return the current version @@ -4010,9 +4011,10 @@ comments: This is used to avoid mixing versions of the .jar and native library. First introduced in rxtx-1.5-9 + Moved from RXTXCommDriver to RXTXVersion in rxtx-2.1-7 ----------------------------------------------------------*/ -JNIEXPORT jstring JNICALL RXTXCommDriver(nativeGetVersion) (JNIEnv *env, +JNIEXPORT jstring JNICALL RXTXVersion(nativeGetVersion) (JNIEnv *env, jclass jclazz ) { return (*env)->NewStringUTF( env, "RXTX-2.1-7pre20" ); From ricardo.trindade at emation.pt Thu Apr 7 03:45:58 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 10:45:58 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: <42550156.2040908@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050407/05212451/attachment-0091.html From thomas.shulok at lmco.com Thu Apr 7 17:43:11 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Thu, 07 Apr 2005 19:43:11 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi There, I'm attempting to talk RS232 between an embedded Linux box and a Windows box. Everything connects up fine, and I can send and receive a simple sequence of bytes with no problems. However, if around 5 seconds goes by without me sending something, I get the following when I attempt to send. java.io.IOException: Input/output error in writeArray Stack trace: java/lang/Throwable.()V java/lang/Throwable.(Ljava/lang/String;)V java/io/IOException.(Ljava/lang/String;)V gnu/io/RXTXPort.writeArray([BIIZ)V gnu/io/RXTXPort$SerialOutputStream.write([B)V SerialTest.main([Ljava/lang/String;)V If there interval is shorter (say 2 seconds between sends), I have no problems. On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and librxtxSerial-2.0.7pre2.so. Any ideas? Thanks, Thom -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5b23dcf/attachment-0091.html From taj at www.linux.org.uk Thu Apr 7 19:22:36 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:22:36 +0100 (BST) Subject: [Rxtx] Input/output error in writeArray In-Reply-To: References: Message-ID: On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a Windows > box. Everything connects up fine, and I can send and receive a simple > sequence of bytes with no problems. However, if around 5 seconds goes > by without me sending something, I get the following when I attempt to > send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Apr 7 19:24:59 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:24:59 +0100 (BST) Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) Message-ID: hmm. This would not work from applets would it? -- Trent Jarvi taj at www.linux.org.uk ---------- Forwarded message ---------- Date: Thu, 07 Apr 2005 16:05:53 -0400 From: Chris Gaffney To: taj at www.linux.org.uk Subject: RXTX Libraries on Classpath fix Hi, I submitted a patch for RXTX a few weeks ago to allow for loading the native libraries from the classpath. Since sending it to you I found it wasn't working on windows. I've fixed the problem and created a new patch that should replace the older one. The actual change is a one line from a String.equals() to a String.startsWith(). Thanks for a great piece of software, -Chris Gaffney Grand Valley State University -------------- next part -------------- A non-text attachment was scrubbed... Name: libraries_on_classpath_fixed.patch Type: text/x-patch Size: 5617 bytes Desc: Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5d423b8/libraries_on_classpath_fixed-0091.bin From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From thomas.shulok at lmco.com Fri Apr 8 10:38:55 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Fri, 08 Apr 2005 12:38:55 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi Trent, Thanks for the prompt response. Before diving deeper, I was wondering if there is a timeout parameter somewhere in the stack that I have not set properly. Given the nature of the failure (only fails if the line has been idle for a few seconds), it feels like some kind of timeout issue... Thanks again, Thom -----Original Message----- From: rxtx-bounces at mail.linuxgrrls.org [mailto:rxtx-bounces at mail.linuxgrrls.org] On Behalf Of Trent Jarvi Sent: Thursday, April 07, 2005 6:23 PM To: Java RXTX discussion Subject: Re: [Rxtx] Input/output error in writeArray On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a > Windows box. Everything connects up fine, and I can send and receive > a simple sequence of bytes with no problems. However, if around 5 > seconds goes by without me sending something, I get the following when > I attempt to send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at mail.linuxgrrls.org http://mail.linuxgrrls.org/mailman/listinfo/rxtx From ricardo.trindade at emation.pt Mon Apr 4 09:17:23 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Mon, 04 Apr 2005 16:17:23 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot Message-ID: <42515A83.4050907@emation.pt> Hi, I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most recent stable snapshot), and get the following exception : It looks like rxtx has been compiled with jdk 1.5. If this was indeed the case, I think there is a compilation flag that generates code that runs on older jdks. java.lang.UnsupportedClassVersionError: gnu/io/UnsupportedCommOperationException (Unsupported major.minor version 49.0) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at java.net.URLClassLoader.defineClass(URLClassLoader.java:251) at java.net.URLClassLoader.access$100(URLClassLoader.java:55) at java.net.URLClassLoader$1.run(URLClassLoader.java:194) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:187) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:141) I'm trying to run it with 1.4. thanks Ricardo From taj at www.linux.org.uk Tue Apr 5 00:48:12 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 07:48:12 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42515A83.4050907@emation.pt> References: <42515A83.4050907@emation.pt> Message-ID: On Mon, 4 Apr 2005, Ricardo Trindade wrote: > Hi, > > I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most > recent stable snapshot), and get the following exception : > > It looks like rxtx has been compiled with jdk 1.5. If this was > indeed the case, I think there is a compilation flag that generates code > that runs on older jdks. > > java.lang.UnsupportedClassVersionError: > gnu/io/UnsupportedCommOperationException (Unsupported major.minor > version 49.0) [snip] Thanks Ricardo I recompiled the jar with javac -source 1.3 -target 1.3. That should cover most of the JRE's in use today. I also compiled the rxtx 2.0 x86_64 native library which appeared to be missing. I tried looking for flags to pass gcc 4.0 to make the native libraries more backwards compatible but only found options for C++ which is not used in rxtx. I've got a list of other bugs that I'll be going through in the next few weeks but for now I just left them with the same CVS filename - no code changes. ftp://ftp.qbang.org/pub/rxtx/rxtx-2.0-CVS-20050120-bins.tar.gz ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-CVS-20050120-bins.tar.gz -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Tue Apr 5 02:24:33 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 05 Apr 2005 09:24:33 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: References: <42515A83.4050907@emation.pt> Message-ID: <42524B41.3040300@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050405/5919abbb/attachment-0092.html From taj at www.linux.org.uk Tue Apr 5 03:00:29 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 10:00:29 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42524B41.3040300@emation.pt> References: <42515A83.4050907@emation.pt> <42524B41.3040300@emation.pt> Message-ID: On Tue, 5 Apr 2005, Ricardo Trindade wrote: > Will you anounce to the list when a new release is available ? > There will be several incremental releases announced here. Once those are done, we will release 2.1.7 and 2.0.7. -- Trent Jarvi taj at www.linux.org.uk From no_spam at somewhere.com Tue Apr 5 11:55:37 2005 From: no_spam at somewhere.com (no_spam@somewhere.com) Date: Tue, 5 Apr 2005 13:55:37 -0400 Subject: [Rxtx] Closing a port from an event listener results in a deadlock Message-ID: <20050405175537.GA21747@rcog.homelinux.net> On the message I sent on March 14, does anyone had the chance to try the modification? Or was it already fixed? (I haven't searched the archive extensively) Or maybe my message got catched by some spam filters? (it made it to the list archive though) Anyway, I would appreciate some feedback (through the list) Thanks From taj at www.linux.org.uk Tue Apr 5 14:42:28 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 21:42:28 +0100 (BST) Subject: [Rxtx] Closing a port from an event listener results in a deadlock In-Reply-To: <20050405175537.GA21747@rcog.homelinux.net> References: <20050405175537.GA21747@rcog.homelinux.net> Message-ID: On Tue, 5 Apr 2005 no_spam at somewhere.com wrote: > On the message I sent on March 14, does anyone had the chance to try the > modification? > > Or was it already fixed? (I haven't searched the archive extensively) > > Or maybe my message got catched by some spam filters? (it made it to the list > archive though) > > Anyway, I would appreciate some feedback (through the list) > The patch is here http://marc.theaimsgroup.com/?l=rxtx&m=111084488820288&w=2 I have applied this patch to a local copy but will not be doing formal testing for a couple weeks. I do not try to close ports from inside the eventListenter usually so I encourage any feedback also. If there are no problems reported, I expect this will go into rxtx 2.1-7. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Wed Apr 6 08:33:42 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Wed, 06 Apr 2005 15:33:42 +0100 Subject: [Rxtx] getting RXTX version Message-ID: <4253F346.50102@emation.pt> Hi, I want to make sure my deployments have the same version of RXTX jar and native lib. I know the version of the jar can be obtained in the Version class, but how can I obtain the native version ? I know RXTX prints to the console a warning if the version is different. Is there a way to programatically know is this is the case ? I would like to log that to our app's log thanks Ricardo From taj at www.linux.org.uk Wed Apr 6 15:10:20 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 6 Apr 2005 22:10:20 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4253F346.50102@emation.pt> References: <4253F346.50102@emation.pt> Message-ID: On Wed, 6 Apr 2005, Ricardo Trindade wrote: > Hi, > > I want to make sure my deployments have the same version of RXTX jar > and native lib. > > I know the version of the jar can be obtained in the Version class, > but how can I obtain the native version ? > > I know RXTX prints to the console a warning if the version is > different. Is there a way to programatically know is this is the case ? > > I would like to log that to our app's log > There isn't a suggested way of doing that right now. We could move things around and have a static String RXTXVersion.getNativeVersion() in future releases. Is this what you expected? This is not documented in commapi at all. I just tossed that in to catch conflicts while developing. It would be nice to have access in GUI applications though. It may be possible to access RXTXCommDriver.LibVersion right now. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Thu Apr 7 02:51:00 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 09:51:00 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> Message-ID: <4254F474.7020905@emation.pt> >There isn't a suggested way of doing that right now. We could move things >around and have a static String RXTXVersion.getNativeVersion() in future >releases. Is this what you expected? > > Yes, that would be perfect. >This is not documented in commapi at all. I just tossed that in to catch >conflicts while developing. It would be nice to have access in GUI >applications though. > >It may be possible to access RXTXCommDriver.LibVersion right now. > > > I tried, and I don't think it's possible. From taj at www.linux.org.uk Thu Apr 7 03:32:04 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 7 Apr 2005 10:32:04 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4254F474.7020905@emation.pt> References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: On Thu, 7 Apr 2005, Ricardo Trindade wrote: > > >There isn't a suggested way of doing that right now. We could move things > >around and have a static String RXTXVersion.getNativeVersion() in future > >releases. Is this what you expected? > > > > > > Yes, that would be perfect. > The attached should do what you want. You will still need to catch an exception for older versions... -- Trent Jarvi taj at www.linux.org.uk -------------- next part -------------- ? public_version.patch Index: RXTXCommDriver.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXCommDriver.java,v retrieving revision 1.16.2.51 diff -u -r1.16.2.51 RXTXCommDriver.java --- RXTXCommDriver.java 12 Oct 2004 09:13:30 -0000 1.16.2.51 +++ RXTXCommDriver.java 7 Apr 2005 09:29:04 -0000 @@ -54,7 +54,7 @@ the Library. */ String JarVersion = RXTXVersion.getVersion(); - String LibVersion = nativeGetVersion(); + String LibVersion = RXTXVersion.nativeGetVersion(); if ( devel ) { System.out.println("Devel Library"); @@ -76,7 +76,6 @@ /** Get the Serial port prefixes for the running OS */ private String deviceDirectory; private String osName; - private static native String nativeGetVersion(); private native boolean registerKnownPorts(int PortType); private native boolean isPortPrefixValid(String dev); private native boolean testRead(String dev, int type); Index: RXTXVersion.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXVersion.java,v retrieving revision 1.2.2.31 diff -u -r1.2.2.31 RXTXVersion.java --- RXTXVersion.java 16 Oct 2004 16:20:35 -0000 1.2.2.31 +++ RXTXVersion.java 7 Apr 2005 09:29:04 -0000 @@ -36,6 +36,7 @@ private static String Version; static { + System.loadLibrary( "rxtxSerial" ); Version = "RXTX-2.1-7pre20"; } /** @@ -47,4 +48,5 @@ { return(Version); } + public static native String nativeGetVersion(); } Index: SerialImp.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v retrieving revision 1.46.2.181 diff -u -r1.46.2.181 SerialImp.c --- SerialImp.c 17 Oct 2004 09:48:56 -0000 1.46.2.181 +++ SerialImp.c 7 Apr 2005 09:29:07 -0000 @@ -116,6 +116,7 @@ * It will eventually be removed. * */ #define RXTXPort(foo) Java_gnu_io_RXTXPort_ ## foo +#define RXTXVersion(foo) Java_gnu_io_RXTXVersion_ ## foo #define RXTXCommDriver(foo) Java_gnu_io_RXTXCommDriver_ ## foo #if defined(__sun__) || defined(__hpux__) @@ -4001,7 +4002,7 @@ } /*---------------------------------------------------------- -RXTXCommDriver.nativeGetVersion +RXTXVersion.nativeGetVersion accept: none perform: return the current version @@ -4010,9 +4011,10 @@ comments: This is used to avoid mixing versions of the .jar and native library. First introduced in rxtx-1.5-9 + Moved from RXTXCommDriver to RXTXVersion in rxtx-2.1-7 ----------------------------------------------------------*/ -JNIEXPORT jstring JNICALL RXTXCommDriver(nativeGetVersion) (JNIEnv *env, +JNIEXPORT jstring JNICALL RXTXVersion(nativeGetVersion) (JNIEnv *env, jclass jclazz ) { return (*env)->NewStringUTF( env, "RXTX-2.1-7pre20" ); From ricardo.trindade at emation.pt Thu Apr 7 03:45:58 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 10:45:58 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: <42550156.2040908@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050407/05212451/attachment-0092.html From thomas.shulok at lmco.com Thu Apr 7 17:43:11 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Thu, 07 Apr 2005 19:43:11 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi There, I'm attempting to talk RS232 between an embedded Linux box and a Windows box. Everything connects up fine, and I can send and receive a simple sequence of bytes with no problems. However, if around 5 seconds goes by without me sending something, I get the following when I attempt to send. java.io.IOException: Input/output error in writeArray Stack trace: java/lang/Throwable.()V java/lang/Throwable.(Ljava/lang/String;)V java/io/IOException.(Ljava/lang/String;)V gnu/io/RXTXPort.writeArray([BIIZ)V gnu/io/RXTXPort$SerialOutputStream.write([B)V SerialTest.main([Ljava/lang/String;)V If there interval is shorter (say 2 seconds between sends), I have no problems. On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and librxtxSerial-2.0.7pre2.so. Any ideas? Thanks, Thom -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5b23dcf/attachment-0092.html From taj at www.linux.org.uk Thu Apr 7 19:22:36 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:22:36 +0100 (BST) Subject: [Rxtx] Input/output error in writeArray In-Reply-To: References: Message-ID: On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a Windows > box. Everything connects up fine, and I can send and receive a simple > sequence of bytes with no problems. However, if around 5 seconds goes > by without me sending something, I get the following when I attempt to > send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Apr 7 19:24:59 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:24:59 +0100 (BST) Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) Message-ID: hmm. This would not work from applets would it? -- Trent Jarvi taj at www.linux.org.uk ---------- Forwarded message ---------- Date: Thu, 07 Apr 2005 16:05:53 -0400 From: Chris Gaffney To: taj at www.linux.org.uk Subject: RXTX Libraries on Classpath fix Hi, I submitted a patch for RXTX a few weeks ago to allow for loading the native libraries from the classpath. Since sending it to you I found it wasn't working on windows. I've fixed the problem and created a new patch that should replace the older one. The actual change is a one line from a String.equals() to a String.startsWith(). Thanks for a great piece of software, -Chris Gaffney Grand Valley State University -------------- next part -------------- A non-text attachment was scrubbed... Name: libraries_on_classpath_fixed.patch Type: text/x-patch Size: 5617 bytes Desc: Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5d423b8/libraries_on_classpath_fixed-0092.bin From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From thomas.shulok at lmco.com Fri Apr 8 10:38:55 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Fri, 08 Apr 2005 12:38:55 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi Trent, Thanks for the prompt response. Before diving deeper, I was wondering if there is a timeout parameter somewhere in the stack that I have not set properly. Given the nature of the failure (only fails if the line has been idle for a few seconds), it feels like some kind of timeout issue... Thanks again, Thom -----Original Message----- From: rxtx-bounces at mail.linuxgrrls.org [mailto:rxtx-bounces at mail.linuxgrrls.org] On Behalf Of Trent Jarvi Sent: Thursday, April 07, 2005 6:23 PM To: Java RXTX discussion Subject: Re: [Rxtx] Input/output error in writeArray On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a > Windows box. Everything connects up fine, and I can send and receive > a simple sequence of bytes with no problems. However, if around 5 > seconds goes by without me sending something, I get the following when > I attempt to send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at mail.linuxgrrls.org http://mail.linuxgrrls.org/mailman/listinfo/rxtx From ricardo.trindade at emation.pt Mon Apr 4 09:17:23 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Mon, 04 Apr 2005 16:17:23 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot Message-ID: <42515A83.4050907@emation.pt> Hi, I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most recent stable snapshot), and get the following exception : It looks like rxtx has been compiled with jdk 1.5. If this was indeed the case, I think there is a compilation flag that generates code that runs on older jdks. java.lang.UnsupportedClassVersionError: gnu/io/UnsupportedCommOperationException (Unsupported major.minor version 49.0) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at java.net.URLClassLoader.defineClass(URLClassLoader.java:251) at java.net.URLClassLoader.access$100(URLClassLoader.java:55) at java.net.URLClassLoader$1.run(URLClassLoader.java:194) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:187) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:141) I'm trying to run it with 1.4. thanks Ricardo From taj at www.linux.org.uk Tue Apr 5 00:48:12 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 07:48:12 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42515A83.4050907@emation.pt> References: <42515A83.4050907@emation.pt> Message-ID: On Mon, 4 Apr 2005, Ricardo Trindade wrote: > Hi, > > I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most > recent stable snapshot), and get the following exception : > > It looks like rxtx has been compiled with jdk 1.5. If this was > indeed the case, I think there is a compilation flag that generates code > that runs on older jdks. > > java.lang.UnsupportedClassVersionError: > gnu/io/UnsupportedCommOperationException (Unsupported major.minor > version 49.0) [snip] Thanks Ricardo I recompiled the jar with javac -source 1.3 -target 1.3. That should cover most of the JRE's in use today. I also compiled the rxtx 2.0 x86_64 native library which appeared to be missing. I tried looking for flags to pass gcc 4.0 to make the native libraries more backwards compatible but only found options for C++ which is not used in rxtx. I've got a list of other bugs that I'll be going through in the next few weeks but for now I just left them with the same CVS filename - no code changes. ftp://ftp.qbang.org/pub/rxtx/rxtx-2.0-CVS-20050120-bins.tar.gz ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-CVS-20050120-bins.tar.gz -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Tue Apr 5 02:24:33 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 05 Apr 2005 09:24:33 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: References: <42515A83.4050907@emation.pt> Message-ID: <42524B41.3040300@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050405/5919abbb/attachment-0093.html From taj at www.linux.org.uk Tue Apr 5 03:00:29 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 10:00:29 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42524B41.3040300@emation.pt> References: <42515A83.4050907@emation.pt> <42524B41.3040300@emation.pt> Message-ID: On Tue, 5 Apr 2005, Ricardo Trindade wrote: > Will you anounce to the list when a new release is available ? > There will be several incremental releases announced here. Once those are done, we will release 2.1.7 and 2.0.7. -- Trent Jarvi taj at www.linux.org.uk From no_spam at somewhere.com Tue Apr 5 11:55:37 2005 From: no_spam at somewhere.com (no_spam@somewhere.com) Date: Tue, 5 Apr 2005 13:55:37 -0400 Subject: [Rxtx] Closing a port from an event listener results in a deadlock Message-ID: <20050405175537.GA21747@rcog.homelinux.net> On the message I sent on March 14, does anyone had the chance to try the modification? Or was it already fixed? (I haven't searched the archive extensively) Or maybe my message got catched by some spam filters? (it made it to the list archive though) Anyway, I would appreciate some feedback (through the list) Thanks From taj at www.linux.org.uk Tue Apr 5 14:42:28 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 21:42:28 +0100 (BST) Subject: [Rxtx] Closing a port from an event listener results in a deadlock In-Reply-To: <20050405175537.GA21747@rcog.homelinux.net> References: <20050405175537.GA21747@rcog.homelinux.net> Message-ID: On Tue, 5 Apr 2005 no_spam at somewhere.com wrote: > On the message I sent on March 14, does anyone had the chance to try the > modification? > > Or was it already fixed? (I haven't searched the archive extensively) > > Or maybe my message got catched by some spam filters? (it made it to the list > archive though) > > Anyway, I would appreciate some feedback (through the list) > The patch is here http://marc.theaimsgroup.com/?l=rxtx&m=111084488820288&w=2 I have applied this patch to a local copy but will not be doing formal testing for a couple weeks. I do not try to close ports from inside the eventListenter usually so I encourage any feedback also. If there are no problems reported, I expect this will go into rxtx 2.1-7. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Wed Apr 6 08:33:42 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Wed, 06 Apr 2005 15:33:42 +0100 Subject: [Rxtx] getting RXTX version Message-ID: <4253F346.50102@emation.pt> Hi, I want to make sure my deployments have the same version of RXTX jar and native lib. I know the version of the jar can be obtained in the Version class, but how can I obtain the native version ? I know RXTX prints to the console a warning if the version is different. Is there a way to programatically know is this is the case ? I would like to log that to our app's log thanks Ricardo From taj at www.linux.org.uk Wed Apr 6 15:10:20 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 6 Apr 2005 22:10:20 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4253F346.50102@emation.pt> References: <4253F346.50102@emation.pt> Message-ID: On Wed, 6 Apr 2005, Ricardo Trindade wrote: > Hi, > > I want to make sure my deployments have the same version of RXTX jar > and native lib. > > I know the version of the jar can be obtained in the Version class, > but how can I obtain the native version ? > > I know RXTX prints to the console a warning if the version is > different. Is there a way to programatically know is this is the case ? > > I would like to log that to our app's log > There isn't a suggested way of doing that right now. We could move things around and have a static String RXTXVersion.getNativeVersion() in future releases. Is this what you expected? This is not documented in commapi at all. I just tossed that in to catch conflicts while developing. It would be nice to have access in GUI applications though. It may be possible to access RXTXCommDriver.LibVersion right now. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Thu Apr 7 02:51:00 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 09:51:00 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> Message-ID: <4254F474.7020905@emation.pt> >There isn't a suggested way of doing that right now. We could move things >around and have a static String RXTXVersion.getNativeVersion() in future >releases. Is this what you expected? > > Yes, that would be perfect. >This is not documented in commapi at all. I just tossed that in to catch >conflicts while developing. It would be nice to have access in GUI >applications though. > >It may be possible to access RXTXCommDriver.LibVersion right now. > > > I tried, and I don't think it's possible. From taj at www.linux.org.uk Thu Apr 7 03:32:04 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 7 Apr 2005 10:32:04 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4254F474.7020905@emation.pt> References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: On Thu, 7 Apr 2005, Ricardo Trindade wrote: > > >There isn't a suggested way of doing that right now. We could move things > >around and have a static String RXTXVersion.getNativeVersion() in future > >releases. Is this what you expected? > > > > > > Yes, that would be perfect. > The attached should do what you want. You will still need to catch an exception for older versions... -- Trent Jarvi taj at www.linux.org.uk -------------- next part -------------- ? public_version.patch Index: RXTXCommDriver.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXCommDriver.java,v retrieving revision 1.16.2.51 diff -u -r1.16.2.51 RXTXCommDriver.java --- RXTXCommDriver.java 12 Oct 2004 09:13:30 -0000 1.16.2.51 +++ RXTXCommDriver.java 7 Apr 2005 09:29:04 -0000 @@ -54,7 +54,7 @@ the Library. */ String JarVersion = RXTXVersion.getVersion(); - String LibVersion = nativeGetVersion(); + String LibVersion = RXTXVersion.nativeGetVersion(); if ( devel ) { System.out.println("Devel Library"); @@ -76,7 +76,6 @@ /** Get the Serial port prefixes for the running OS */ private String deviceDirectory; private String osName; - private static native String nativeGetVersion(); private native boolean registerKnownPorts(int PortType); private native boolean isPortPrefixValid(String dev); private native boolean testRead(String dev, int type); Index: RXTXVersion.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXVersion.java,v retrieving revision 1.2.2.31 diff -u -r1.2.2.31 RXTXVersion.java --- RXTXVersion.java 16 Oct 2004 16:20:35 -0000 1.2.2.31 +++ RXTXVersion.java 7 Apr 2005 09:29:04 -0000 @@ -36,6 +36,7 @@ private static String Version; static { + System.loadLibrary( "rxtxSerial" ); Version = "RXTX-2.1-7pre20"; } /** @@ -47,4 +48,5 @@ { return(Version); } + public static native String nativeGetVersion(); } Index: SerialImp.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v retrieving revision 1.46.2.181 diff -u -r1.46.2.181 SerialImp.c --- SerialImp.c 17 Oct 2004 09:48:56 -0000 1.46.2.181 +++ SerialImp.c 7 Apr 2005 09:29:07 -0000 @@ -116,6 +116,7 @@ * It will eventually be removed. * */ #define RXTXPort(foo) Java_gnu_io_RXTXPort_ ## foo +#define RXTXVersion(foo) Java_gnu_io_RXTXVersion_ ## foo #define RXTXCommDriver(foo) Java_gnu_io_RXTXCommDriver_ ## foo #if defined(__sun__) || defined(__hpux__) @@ -4001,7 +4002,7 @@ } /*---------------------------------------------------------- -RXTXCommDriver.nativeGetVersion +RXTXVersion.nativeGetVersion accept: none perform: return the current version @@ -4010,9 +4011,10 @@ comments: This is used to avoid mixing versions of the .jar and native library. First introduced in rxtx-1.5-9 + Moved from RXTXCommDriver to RXTXVersion in rxtx-2.1-7 ----------------------------------------------------------*/ -JNIEXPORT jstring JNICALL RXTXCommDriver(nativeGetVersion) (JNIEnv *env, +JNIEXPORT jstring JNICALL RXTXVersion(nativeGetVersion) (JNIEnv *env, jclass jclazz ) { return (*env)->NewStringUTF( env, "RXTX-2.1-7pre20" ); From ricardo.trindade at emation.pt Thu Apr 7 03:45:58 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 10:45:58 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: <42550156.2040908@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050407/05212451/attachment-0093.html From thomas.shulok at lmco.com Thu Apr 7 17:43:11 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Thu, 07 Apr 2005 19:43:11 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi There, I'm attempting to talk RS232 between an embedded Linux box and a Windows box. Everything connects up fine, and I can send and receive a simple sequence of bytes with no problems. However, if around 5 seconds goes by without me sending something, I get the following when I attempt to send. java.io.IOException: Input/output error in writeArray Stack trace: java/lang/Throwable.()V java/lang/Throwable.(Ljava/lang/String;)V java/io/IOException.(Ljava/lang/String;)V gnu/io/RXTXPort.writeArray([BIIZ)V gnu/io/RXTXPort$SerialOutputStream.write([B)V SerialTest.main([Ljava/lang/String;)V If there interval is shorter (say 2 seconds between sends), I have no problems. On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and librxtxSerial-2.0.7pre2.so. Any ideas? Thanks, Thom -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5b23dcf/attachment-0093.html From taj at www.linux.org.uk Thu Apr 7 19:22:36 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:22:36 +0100 (BST) Subject: [Rxtx] Input/output error in writeArray In-Reply-To: References: Message-ID: On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a Windows > box. Everything connects up fine, and I can send and receive a simple > sequence of bytes with no problems. However, if around 5 seconds goes > by without me sending something, I get the following when I attempt to > send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Apr 7 19:24:59 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:24:59 +0100 (BST) Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) Message-ID: hmm. This would not work from applets would it? -- Trent Jarvi taj at www.linux.org.uk ---------- Forwarded message ---------- Date: Thu, 07 Apr 2005 16:05:53 -0400 From: Chris Gaffney To: taj at www.linux.org.uk Subject: RXTX Libraries on Classpath fix Hi, I submitted a patch for RXTX a few weeks ago to allow for loading the native libraries from the classpath. Since sending it to you I found it wasn't working on windows. I've fixed the problem and created a new patch that should replace the older one. The actual change is a one line from a String.equals() to a String.startsWith(). Thanks for a great piece of software, -Chris Gaffney Grand Valley State University -------------- next part -------------- A non-text attachment was scrubbed... Name: libraries_on_classpath_fixed.patch Type: text/x-patch Size: 5617 bytes Desc: Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5d423b8/libraries_on_classpath_fixed-0093.bin From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From thomas.shulok at lmco.com Fri Apr 8 10:38:55 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Fri, 08 Apr 2005 12:38:55 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi Trent, Thanks for the prompt response. Before diving deeper, I was wondering if there is a timeout parameter somewhere in the stack that I have not set properly. Given the nature of the failure (only fails if the line has been idle for a few seconds), it feels like some kind of timeout issue... Thanks again, Thom -----Original Message----- From: rxtx-bounces at mail.linuxgrrls.org [mailto:rxtx-bounces at mail.linuxgrrls.org] On Behalf Of Trent Jarvi Sent: Thursday, April 07, 2005 6:23 PM To: Java RXTX discussion Subject: Re: [Rxtx] Input/output error in writeArray On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a > Windows box. Everything connects up fine, and I can send and receive > a simple sequence of bytes with no problems. However, if around 5 > seconds goes by without me sending something, I get the following when > I attempt to send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at mail.linuxgrrls.org http://mail.linuxgrrls.org/mailman/listinfo/rxtx From ricardo.trindade at emation.pt Mon Apr 4 09:17:23 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Mon, 04 Apr 2005 16:17:23 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot Message-ID: <42515A83.4050907@emation.pt> Hi, I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most recent stable snapshot), and get the following exception : It looks like rxtx has been compiled with jdk 1.5. If this was indeed the case, I think there is a compilation flag that generates code that runs on older jdks. java.lang.UnsupportedClassVersionError: gnu/io/UnsupportedCommOperationException (Unsupported major.minor version 49.0) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at java.net.URLClassLoader.defineClass(URLClassLoader.java:251) at java.net.URLClassLoader.access$100(URLClassLoader.java:55) at java.net.URLClassLoader$1.run(URLClassLoader.java:194) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:187) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:141) I'm trying to run it with 1.4. thanks Ricardo From taj at www.linux.org.uk Tue Apr 5 00:48:12 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 07:48:12 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42515A83.4050907@emation.pt> References: <42515A83.4050907@emation.pt> Message-ID: On Mon, 4 Apr 2005, Ricardo Trindade wrote: > Hi, > > I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most > recent stable snapshot), and get the following exception : > > It looks like rxtx has been compiled with jdk 1.5. If this was > indeed the case, I think there is a compilation flag that generates code > that runs on older jdks. > > java.lang.UnsupportedClassVersionError: > gnu/io/UnsupportedCommOperationException (Unsupported major.minor > version 49.0) [snip] Thanks Ricardo I recompiled the jar with javac -source 1.3 -target 1.3. That should cover most of the JRE's in use today. I also compiled the rxtx 2.0 x86_64 native library which appeared to be missing. I tried looking for flags to pass gcc 4.0 to make the native libraries more backwards compatible but only found options for C++ which is not used in rxtx. I've got a list of other bugs that I'll be going through in the next few weeks but for now I just left them with the same CVS filename - no code changes. ftp://ftp.qbang.org/pub/rxtx/rxtx-2.0-CVS-20050120-bins.tar.gz ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-CVS-20050120-bins.tar.gz -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Tue Apr 5 02:24:33 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 05 Apr 2005 09:24:33 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: References: <42515A83.4050907@emation.pt> Message-ID: <42524B41.3040300@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050405/5919abbb/attachment-0094.html From taj at www.linux.org.uk Tue Apr 5 03:00:29 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 10:00:29 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42524B41.3040300@emation.pt> References: <42515A83.4050907@emation.pt> <42524B41.3040300@emation.pt> Message-ID: On Tue, 5 Apr 2005, Ricardo Trindade wrote: > Will you anounce to the list when a new release is available ? > There will be several incremental releases announced here. Once those are done, we will release 2.1.7 and 2.0.7. -- Trent Jarvi taj at www.linux.org.uk From no_spam at somewhere.com Tue Apr 5 11:55:37 2005 From: no_spam at somewhere.com (no_spam@somewhere.com) Date: Tue, 5 Apr 2005 13:55:37 -0400 Subject: [Rxtx] Closing a port from an event listener results in a deadlock Message-ID: <20050405175537.GA21747@rcog.homelinux.net> On the message I sent on March 14, does anyone had the chance to try the modification? Or was it already fixed? (I haven't searched the archive extensively) Or maybe my message got catched by some spam filters? (it made it to the list archive though) Anyway, I would appreciate some feedback (through the list) Thanks From taj at www.linux.org.uk Tue Apr 5 14:42:28 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 21:42:28 +0100 (BST) Subject: [Rxtx] Closing a port from an event listener results in a deadlock In-Reply-To: <20050405175537.GA21747@rcog.homelinux.net> References: <20050405175537.GA21747@rcog.homelinux.net> Message-ID: On Tue, 5 Apr 2005 no_spam at somewhere.com wrote: > On the message I sent on March 14, does anyone had the chance to try the > modification? > > Or was it already fixed? (I haven't searched the archive extensively) > > Or maybe my message got catched by some spam filters? (it made it to the list > archive though) > > Anyway, I would appreciate some feedback (through the list) > The patch is here http://marc.theaimsgroup.com/?l=rxtx&m=111084488820288&w=2 I have applied this patch to a local copy but will not be doing formal testing for a couple weeks. I do not try to close ports from inside the eventListenter usually so I encourage any feedback also. If there are no problems reported, I expect this will go into rxtx 2.1-7. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Wed Apr 6 08:33:42 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Wed, 06 Apr 2005 15:33:42 +0100 Subject: [Rxtx] getting RXTX version Message-ID: <4253F346.50102@emation.pt> Hi, I want to make sure my deployments have the same version of RXTX jar and native lib. I know the version of the jar can be obtained in the Version class, but how can I obtain the native version ? I know RXTX prints to the console a warning if the version is different. Is there a way to programatically know is this is the case ? I would like to log that to our app's log thanks Ricardo From taj at www.linux.org.uk Wed Apr 6 15:10:20 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 6 Apr 2005 22:10:20 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4253F346.50102@emation.pt> References: <4253F346.50102@emation.pt> Message-ID: On Wed, 6 Apr 2005, Ricardo Trindade wrote: > Hi, > > I want to make sure my deployments have the same version of RXTX jar > and native lib. > > I know the version of the jar can be obtained in the Version class, > but how can I obtain the native version ? > > I know RXTX prints to the console a warning if the version is > different. Is there a way to programatically know is this is the case ? > > I would like to log that to our app's log > There isn't a suggested way of doing that right now. We could move things around and have a static String RXTXVersion.getNativeVersion() in future releases. Is this what you expected? This is not documented in commapi at all. I just tossed that in to catch conflicts while developing. It would be nice to have access in GUI applications though. It may be possible to access RXTXCommDriver.LibVersion right now. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Thu Apr 7 02:51:00 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 09:51:00 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> Message-ID: <4254F474.7020905@emation.pt> >There isn't a suggested way of doing that right now. We could move things >around and have a static String RXTXVersion.getNativeVersion() in future >releases. Is this what you expected? > > Yes, that would be perfect. >This is not documented in commapi at all. I just tossed that in to catch >conflicts while developing. It would be nice to have access in GUI >applications though. > >It may be possible to access RXTXCommDriver.LibVersion right now. > > > I tried, and I don't think it's possible. From taj at www.linux.org.uk Thu Apr 7 03:32:04 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 7 Apr 2005 10:32:04 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4254F474.7020905@emation.pt> References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: On Thu, 7 Apr 2005, Ricardo Trindade wrote: > > >There isn't a suggested way of doing that right now. We could move things > >around and have a static String RXTXVersion.getNativeVersion() in future > >releases. Is this what you expected? > > > > > > Yes, that would be perfect. > The attached should do what you want. You will still need to catch an exception for older versions... -- Trent Jarvi taj at www.linux.org.uk -------------- next part -------------- ? public_version.patch Index: RXTXCommDriver.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXCommDriver.java,v retrieving revision 1.16.2.51 diff -u -r1.16.2.51 RXTXCommDriver.java --- RXTXCommDriver.java 12 Oct 2004 09:13:30 -0000 1.16.2.51 +++ RXTXCommDriver.java 7 Apr 2005 09:29:04 -0000 @@ -54,7 +54,7 @@ the Library. */ String JarVersion = RXTXVersion.getVersion(); - String LibVersion = nativeGetVersion(); + String LibVersion = RXTXVersion.nativeGetVersion(); if ( devel ) { System.out.println("Devel Library"); @@ -76,7 +76,6 @@ /** Get the Serial port prefixes for the running OS */ private String deviceDirectory; private String osName; - private static native String nativeGetVersion(); private native boolean registerKnownPorts(int PortType); private native boolean isPortPrefixValid(String dev); private native boolean testRead(String dev, int type); Index: RXTXVersion.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXVersion.java,v retrieving revision 1.2.2.31 diff -u -r1.2.2.31 RXTXVersion.java --- RXTXVersion.java 16 Oct 2004 16:20:35 -0000 1.2.2.31 +++ RXTXVersion.java 7 Apr 2005 09:29:04 -0000 @@ -36,6 +36,7 @@ private static String Version; static { + System.loadLibrary( "rxtxSerial" ); Version = "RXTX-2.1-7pre20"; } /** @@ -47,4 +48,5 @@ { return(Version); } + public static native String nativeGetVersion(); } Index: SerialImp.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v retrieving revision 1.46.2.181 diff -u -r1.46.2.181 SerialImp.c --- SerialImp.c 17 Oct 2004 09:48:56 -0000 1.46.2.181 +++ SerialImp.c 7 Apr 2005 09:29:07 -0000 @@ -116,6 +116,7 @@ * It will eventually be removed. * */ #define RXTXPort(foo) Java_gnu_io_RXTXPort_ ## foo +#define RXTXVersion(foo) Java_gnu_io_RXTXVersion_ ## foo #define RXTXCommDriver(foo) Java_gnu_io_RXTXCommDriver_ ## foo #if defined(__sun__) || defined(__hpux__) @@ -4001,7 +4002,7 @@ } /*---------------------------------------------------------- -RXTXCommDriver.nativeGetVersion +RXTXVersion.nativeGetVersion accept: none perform: return the current version @@ -4010,9 +4011,10 @@ comments: This is used to avoid mixing versions of the .jar and native library. First introduced in rxtx-1.5-9 + Moved from RXTXCommDriver to RXTXVersion in rxtx-2.1-7 ----------------------------------------------------------*/ -JNIEXPORT jstring JNICALL RXTXCommDriver(nativeGetVersion) (JNIEnv *env, +JNIEXPORT jstring JNICALL RXTXVersion(nativeGetVersion) (JNIEnv *env, jclass jclazz ) { return (*env)->NewStringUTF( env, "RXTX-2.1-7pre20" ); From ricardo.trindade at emation.pt Thu Apr 7 03:45:58 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 10:45:58 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: <42550156.2040908@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050407/05212451/attachment-0094.html From thomas.shulok at lmco.com Thu Apr 7 17:43:11 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Thu, 07 Apr 2005 19:43:11 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi There, I'm attempting to talk RS232 between an embedded Linux box and a Windows box. Everything connects up fine, and I can send and receive a simple sequence of bytes with no problems. However, if around 5 seconds goes by without me sending something, I get the following when I attempt to send. java.io.IOException: Input/output error in writeArray Stack trace: java/lang/Throwable.()V java/lang/Throwable.(Ljava/lang/String;)V java/io/IOException.(Ljava/lang/String;)V gnu/io/RXTXPort.writeArray([BIIZ)V gnu/io/RXTXPort$SerialOutputStream.write([B)V SerialTest.main([Ljava/lang/String;)V If there interval is shorter (say 2 seconds between sends), I have no problems. On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and librxtxSerial-2.0.7pre2.so. Any ideas? Thanks, Thom -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5b23dcf/attachment-0094.html From taj at www.linux.org.uk Thu Apr 7 19:22:36 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:22:36 +0100 (BST) Subject: [Rxtx] Input/output error in writeArray In-Reply-To: References: Message-ID: On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a Windows > box. Everything connects up fine, and I can send and receive a simple > sequence of bytes with no problems. However, if around 5 seconds goes > by without me sending something, I get the following when I attempt to > send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Apr 7 19:24:59 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:24:59 +0100 (BST) Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) Message-ID: hmm. This would not work from applets would it? -- Trent Jarvi taj at www.linux.org.uk ---------- Forwarded message ---------- Date: Thu, 07 Apr 2005 16:05:53 -0400 From: Chris Gaffney To: taj at www.linux.org.uk Subject: RXTX Libraries on Classpath fix Hi, I submitted a patch for RXTX a few weeks ago to allow for loading the native libraries from the classpath. Since sending it to you I found it wasn't working on windows. I've fixed the problem and created a new patch that should replace the older one. The actual change is a one line from a String.equals() to a String.startsWith(). Thanks for a great piece of software, -Chris Gaffney Grand Valley State University -------------- next part -------------- A non-text attachment was scrubbed... Name: libraries_on_classpath_fixed.patch Type: text/x-patch Size: 5617 bytes Desc: Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5d423b8/libraries_on_classpath_fixed-0094.bin From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From thomas.shulok at lmco.com Fri Apr 8 10:38:55 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Fri, 08 Apr 2005 12:38:55 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi Trent, Thanks for the prompt response. Before diving deeper, I was wondering if there is a timeout parameter somewhere in the stack that I have not set properly. Given the nature of the failure (only fails if the line has been idle for a few seconds), it feels like some kind of timeout issue... Thanks again, Thom -----Original Message----- From: rxtx-bounces at mail.linuxgrrls.org [mailto:rxtx-bounces at mail.linuxgrrls.org] On Behalf Of Trent Jarvi Sent: Thursday, April 07, 2005 6:23 PM To: Java RXTX discussion Subject: Re: [Rxtx] Input/output error in writeArray On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a > Windows box. Everything connects up fine, and I can send and receive > a simple sequence of bytes with no problems. However, if around 5 > seconds goes by without me sending something, I get the following when > I attempt to send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at mail.linuxgrrls.org http://mail.linuxgrrls.org/mailman/listinfo/rxtx From ricardo.trindade at emation.pt Mon Apr 4 09:17:23 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Mon, 04 Apr 2005 16:17:23 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot Message-ID: <42515A83.4050907@emation.pt> Hi, I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most recent stable snapshot), and get the following exception : It looks like rxtx has been compiled with jdk 1.5. If this was indeed the case, I think there is a compilation flag that generates code that runs on older jdks. java.lang.UnsupportedClassVersionError: gnu/io/UnsupportedCommOperationException (Unsupported major.minor version 49.0) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at java.net.URLClassLoader.defineClass(URLClassLoader.java:251) at java.net.URLClassLoader.access$100(URLClassLoader.java:55) at java.net.URLClassLoader$1.run(URLClassLoader.java:194) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:187) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:141) I'm trying to run it with 1.4. thanks Ricardo From taj at www.linux.org.uk Tue Apr 5 00:48:12 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 07:48:12 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42515A83.4050907@emation.pt> References: <42515A83.4050907@emation.pt> Message-ID: On Mon, 4 Apr 2005, Ricardo Trindade wrote: > Hi, > > I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most > recent stable snapshot), and get the following exception : > > It looks like rxtx has been compiled with jdk 1.5. If this was > indeed the case, I think there is a compilation flag that generates code > that runs on older jdks. > > java.lang.UnsupportedClassVersionError: > gnu/io/UnsupportedCommOperationException (Unsupported major.minor > version 49.0) [snip] Thanks Ricardo I recompiled the jar with javac -source 1.3 -target 1.3. That should cover most of the JRE's in use today. I also compiled the rxtx 2.0 x86_64 native library which appeared to be missing. I tried looking for flags to pass gcc 4.0 to make the native libraries more backwards compatible but only found options for C++ which is not used in rxtx. I've got a list of other bugs that I'll be going through in the next few weeks but for now I just left them with the same CVS filename - no code changes. ftp://ftp.qbang.org/pub/rxtx/rxtx-2.0-CVS-20050120-bins.tar.gz ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-CVS-20050120-bins.tar.gz -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Tue Apr 5 02:24:33 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 05 Apr 2005 09:24:33 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: References: <42515A83.4050907@emation.pt> Message-ID: <42524B41.3040300@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050405/5919abbb/attachment-0095.html From taj at www.linux.org.uk Tue Apr 5 03:00:29 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 10:00:29 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42524B41.3040300@emation.pt> References: <42515A83.4050907@emation.pt> <42524B41.3040300@emation.pt> Message-ID: On Tue, 5 Apr 2005, Ricardo Trindade wrote: > Will you anounce to the list when a new release is available ? > There will be several incremental releases announced here. Once those are done, we will release 2.1.7 and 2.0.7. -- Trent Jarvi taj at www.linux.org.uk From no_spam at somewhere.com Tue Apr 5 11:55:37 2005 From: no_spam at somewhere.com (no_spam@somewhere.com) Date: Tue, 5 Apr 2005 13:55:37 -0400 Subject: [Rxtx] Closing a port from an event listener results in a deadlock Message-ID: <20050405175537.GA21747@rcog.homelinux.net> On the message I sent on March 14, does anyone had the chance to try the modification? Or was it already fixed? (I haven't searched the archive extensively) Or maybe my message got catched by some spam filters? (it made it to the list archive though) Anyway, I would appreciate some feedback (through the list) Thanks From taj at www.linux.org.uk Tue Apr 5 14:42:28 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 21:42:28 +0100 (BST) Subject: [Rxtx] Closing a port from an event listener results in a deadlock In-Reply-To: <20050405175537.GA21747@rcog.homelinux.net> References: <20050405175537.GA21747@rcog.homelinux.net> Message-ID: On Tue, 5 Apr 2005 no_spam at somewhere.com wrote: > On the message I sent on March 14, does anyone had the chance to try the > modification? > > Or was it already fixed? (I haven't searched the archive extensively) > > Or maybe my message got catched by some spam filters? (it made it to the list > archive though) > > Anyway, I would appreciate some feedback (through the list) > The patch is here http://marc.theaimsgroup.com/?l=rxtx&m=111084488820288&w=2 I have applied this patch to a local copy but will not be doing formal testing for a couple weeks. I do not try to close ports from inside the eventListenter usually so I encourage any feedback also. If there are no problems reported, I expect this will go into rxtx 2.1-7. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Wed Apr 6 08:33:42 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Wed, 06 Apr 2005 15:33:42 +0100 Subject: [Rxtx] getting RXTX version Message-ID: <4253F346.50102@emation.pt> Hi, I want to make sure my deployments have the same version of RXTX jar and native lib. I know the version of the jar can be obtained in the Version class, but how can I obtain the native version ? I know RXTX prints to the console a warning if the version is different. Is there a way to programatically know is this is the case ? I would like to log that to our app's log thanks Ricardo From taj at www.linux.org.uk Wed Apr 6 15:10:20 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 6 Apr 2005 22:10:20 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4253F346.50102@emation.pt> References: <4253F346.50102@emation.pt> Message-ID: On Wed, 6 Apr 2005, Ricardo Trindade wrote: > Hi, > > I want to make sure my deployments have the same version of RXTX jar > and native lib. > > I know the version of the jar can be obtained in the Version class, > but how can I obtain the native version ? > > I know RXTX prints to the console a warning if the version is > different. Is there a way to programatically know is this is the case ? > > I would like to log that to our app's log > There isn't a suggested way of doing that right now. We could move things around and have a static String RXTXVersion.getNativeVersion() in future releases. Is this what you expected? This is not documented in commapi at all. I just tossed that in to catch conflicts while developing. It would be nice to have access in GUI applications though. It may be possible to access RXTXCommDriver.LibVersion right now. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Thu Apr 7 02:51:00 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 09:51:00 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> Message-ID: <4254F474.7020905@emation.pt> >There isn't a suggested way of doing that right now. We could move things >around and have a static String RXTXVersion.getNativeVersion() in future >releases. Is this what you expected? > > Yes, that would be perfect. >This is not documented in commapi at all. I just tossed that in to catch >conflicts while developing. It would be nice to have access in GUI >applications though. > >It may be possible to access RXTXCommDriver.LibVersion right now. > > > I tried, and I don't think it's possible. From taj at www.linux.org.uk Thu Apr 7 03:32:04 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 7 Apr 2005 10:32:04 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4254F474.7020905@emation.pt> References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: On Thu, 7 Apr 2005, Ricardo Trindade wrote: > > >There isn't a suggested way of doing that right now. We could move things > >around and have a static String RXTXVersion.getNativeVersion() in future > >releases. Is this what you expected? > > > > > > Yes, that would be perfect. > The attached should do what you want. You will still need to catch an exception for older versions... -- Trent Jarvi taj at www.linux.org.uk -------------- next part -------------- ? public_version.patch Index: RXTXCommDriver.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXCommDriver.java,v retrieving revision 1.16.2.51 diff -u -r1.16.2.51 RXTXCommDriver.java --- RXTXCommDriver.java 12 Oct 2004 09:13:30 -0000 1.16.2.51 +++ RXTXCommDriver.java 7 Apr 2005 09:29:04 -0000 @@ -54,7 +54,7 @@ the Library. */ String JarVersion = RXTXVersion.getVersion(); - String LibVersion = nativeGetVersion(); + String LibVersion = RXTXVersion.nativeGetVersion(); if ( devel ) { System.out.println("Devel Library"); @@ -76,7 +76,6 @@ /** Get the Serial port prefixes for the running OS */ private String deviceDirectory; private String osName; - private static native String nativeGetVersion(); private native boolean registerKnownPorts(int PortType); private native boolean isPortPrefixValid(String dev); private native boolean testRead(String dev, int type); Index: RXTXVersion.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXVersion.java,v retrieving revision 1.2.2.31 diff -u -r1.2.2.31 RXTXVersion.java --- RXTXVersion.java 16 Oct 2004 16:20:35 -0000 1.2.2.31 +++ RXTXVersion.java 7 Apr 2005 09:29:04 -0000 @@ -36,6 +36,7 @@ private static String Version; static { + System.loadLibrary( "rxtxSerial" ); Version = "RXTX-2.1-7pre20"; } /** @@ -47,4 +48,5 @@ { return(Version); } + public static native String nativeGetVersion(); } Index: SerialImp.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v retrieving revision 1.46.2.181 diff -u -r1.46.2.181 SerialImp.c --- SerialImp.c 17 Oct 2004 09:48:56 -0000 1.46.2.181 +++ SerialImp.c 7 Apr 2005 09:29:07 -0000 @@ -116,6 +116,7 @@ * It will eventually be removed. * */ #define RXTXPort(foo) Java_gnu_io_RXTXPort_ ## foo +#define RXTXVersion(foo) Java_gnu_io_RXTXVersion_ ## foo #define RXTXCommDriver(foo) Java_gnu_io_RXTXCommDriver_ ## foo #if defined(__sun__) || defined(__hpux__) @@ -4001,7 +4002,7 @@ } /*---------------------------------------------------------- -RXTXCommDriver.nativeGetVersion +RXTXVersion.nativeGetVersion accept: none perform: return the current version @@ -4010,9 +4011,10 @@ comments: This is used to avoid mixing versions of the .jar and native library. First introduced in rxtx-1.5-9 + Moved from RXTXCommDriver to RXTXVersion in rxtx-2.1-7 ----------------------------------------------------------*/ -JNIEXPORT jstring JNICALL RXTXCommDriver(nativeGetVersion) (JNIEnv *env, +JNIEXPORT jstring JNICALL RXTXVersion(nativeGetVersion) (JNIEnv *env, jclass jclazz ) { return (*env)->NewStringUTF( env, "RXTX-2.1-7pre20" ); From ricardo.trindade at emation.pt Thu Apr 7 03:45:58 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 10:45:58 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: <42550156.2040908@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050407/05212451/attachment-0095.html From thomas.shulok at lmco.com Thu Apr 7 17:43:11 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Thu, 07 Apr 2005 19:43:11 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi There, I'm attempting to talk RS232 between an embedded Linux box and a Windows box. Everything connects up fine, and I can send and receive a simple sequence of bytes with no problems. However, if around 5 seconds goes by without me sending something, I get the following when I attempt to send. java.io.IOException: Input/output error in writeArray Stack trace: java/lang/Throwable.()V java/lang/Throwable.(Ljava/lang/String;)V java/io/IOException.(Ljava/lang/String;)V gnu/io/RXTXPort.writeArray([BIIZ)V gnu/io/RXTXPort$SerialOutputStream.write([B)V SerialTest.main([Ljava/lang/String;)V If there interval is shorter (say 2 seconds between sends), I have no problems. On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and librxtxSerial-2.0.7pre2.so. Any ideas? Thanks, Thom -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5b23dcf/attachment-0095.html From taj at www.linux.org.uk Thu Apr 7 19:22:36 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:22:36 +0100 (BST) Subject: [Rxtx] Input/output error in writeArray In-Reply-To: References: Message-ID: On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a Windows > box. Everything connects up fine, and I can send and receive a simple > sequence of bytes with no problems. However, if around 5 seconds goes > by without me sending something, I get the following when I attempt to > send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Apr 7 19:24:59 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:24:59 +0100 (BST) Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) Message-ID: hmm. This would not work from applets would it? -- Trent Jarvi taj at www.linux.org.uk ---------- Forwarded message ---------- Date: Thu, 07 Apr 2005 16:05:53 -0400 From: Chris Gaffney To: taj at www.linux.org.uk Subject: RXTX Libraries on Classpath fix Hi, I submitted a patch for RXTX a few weeks ago to allow for loading the native libraries from the classpath. Since sending it to you I found it wasn't working on windows. I've fixed the problem and created a new patch that should replace the older one. The actual change is a one line from a String.equals() to a String.startsWith(). Thanks for a great piece of software, -Chris Gaffney Grand Valley State University -------------- next part -------------- A non-text attachment was scrubbed... Name: libraries_on_classpath_fixed.patch Type: text/x-patch Size: 5617 bytes Desc: Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5d423b8/libraries_on_classpath_fixed-0095.bin From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From thomas.shulok at lmco.com Fri Apr 8 10:38:55 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Fri, 08 Apr 2005 12:38:55 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi Trent, Thanks for the prompt response. Before diving deeper, I was wondering if there is a timeout parameter somewhere in the stack that I have not set properly. Given the nature of the failure (only fails if the line has been idle for a few seconds), it feels like some kind of timeout issue... Thanks again, Thom -----Original Message----- From: rxtx-bounces at mail.linuxgrrls.org [mailto:rxtx-bounces at mail.linuxgrrls.org] On Behalf Of Trent Jarvi Sent: Thursday, April 07, 2005 6:23 PM To: Java RXTX discussion Subject: Re: [Rxtx] Input/output error in writeArray On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a > Windows box. Everything connects up fine, and I can send and receive > a simple sequence of bytes with no problems. However, if around 5 > seconds goes by without me sending something, I get the following when > I attempt to send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at mail.linuxgrrls.org http://mail.linuxgrrls.org/mailman/listinfo/rxtx From ricardo.trindade at emation.pt Mon Apr 4 09:17:23 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Mon, 04 Apr 2005 16:17:23 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot Message-ID: <42515A83.4050907@emation.pt> Hi, I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most recent stable snapshot), and get the following exception : It looks like rxtx has been compiled with jdk 1.5. If this was indeed the case, I think there is a compilation flag that generates code that runs on older jdks. java.lang.UnsupportedClassVersionError: gnu/io/UnsupportedCommOperationException (Unsupported major.minor version 49.0) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at java.net.URLClassLoader.defineClass(URLClassLoader.java:251) at java.net.URLClassLoader.access$100(URLClassLoader.java:55) at java.net.URLClassLoader$1.run(URLClassLoader.java:194) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:187) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:141) I'm trying to run it with 1.4. thanks Ricardo From taj at www.linux.org.uk Tue Apr 5 00:48:12 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 07:48:12 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42515A83.4050907@emation.pt> References: <42515A83.4050907@emation.pt> Message-ID: On Mon, 4 Apr 2005, Ricardo Trindade wrote: > Hi, > > I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most > recent stable snapshot), and get the following exception : > > It looks like rxtx has been compiled with jdk 1.5. If this was > indeed the case, I think there is a compilation flag that generates code > that runs on older jdks. > > java.lang.UnsupportedClassVersionError: > gnu/io/UnsupportedCommOperationException (Unsupported major.minor > version 49.0) [snip] Thanks Ricardo I recompiled the jar with javac -source 1.3 -target 1.3. That should cover most of the JRE's in use today. I also compiled the rxtx 2.0 x86_64 native library which appeared to be missing. I tried looking for flags to pass gcc 4.0 to make the native libraries more backwards compatible but only found options for C++ which is not used in rxtx. I've got a list of other bugs that I'll be going through in the next few weeks but for now I just left them with the same CVS filename - no code changes. ftp://ftp.qbang.org/pub/rxtx/rxtx-2.0-CVS-20050120-bins.tar.gz ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-CVS-20050120-bins.tar.gz -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Tue Apr 5 02:24:33 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 05 Apr 2005 09:24:33 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: References: <42515A83.4050907@emation.pt> Message-ID: <42524B41.3040300@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050405/5919abbb/attachment-0096.html From taj at www.linux.org.uk Tue Apr 5 03:00:29 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 10:00:29 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42524B41.3040300@emation.pt> References: <42515A83.4050907@emation.pt> <42524B41.3040300@emation.pt> Message-ID: On Tue, 5 Apr 2005, Ricardo Trindade wrote: > Will you anounce to the list when a new release is available ? > There will be several incremental releases announced here. Once those are done, we will release 2.1.7 and 2.0.7. -- Trent Jarvi taj at www.linux.org.uk From no_spam at somewhere.com Tue Apr 5 11:55:37 2005 From: no_spam at somewhere.com (no_spam@somewhere.com) Date: Tue, 5 Apr 2005 13:55:37 -0400 Subject: [Rxtx] Closing a port from an event listener results in a deadlock Message-ID: <20050405175537.GA21747@rcog.homelinux.net> On the message I sent on March 14, does anyone had the chance to try the modification? Or was it already fixed? (I haven't searched the archive extensively) Or maybe my message got catched by some spam filters? (it made it to the list archive though) Anyway, I would appreciate some feedback (through the list) Thanks From taj at www.linux.org.uk Tue Apr 5 14:42:28 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 21:42:28 +0100 (BST) Subject: [Rxtx] Closing a port from an event listener results in a deadlock In-Reply-To: <20050405175537.GA21747@rcog.homelinux.net> References: <20050405175537.GA21747@rcog.homelinux.net> Message-ID: On Tue, 5 Apr 2005 no_spam at somewhere.com wrote: > On the message I sent on March 14, does anyone had the chance to try the > modification? > > Or was it already fixed? (I haven't searched the archive extensively) > > Or maybe my message got catched by some spam filters? (it made it to the list > archive though) > > Anyway, I would appreciate some feedback (through the list) > The patch is here http://marc.theaimsgroup.com/?l=rxtx&m=111084488820288&w=2 I have applied this patch to a local copy but will not be doing formal testing for a couple weeks. I do not try to close ports from inside the eventListenter usually so I encourage any feedback also. If there are no problems reported, I expect this will go into rxtx 2.1-7. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Wed Apr 6 08:33:42 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Wed, 06 Apr 2005 15:33:42 +0100 Subject: [Rxtx] getting RXTX version Message-ID: <4253F346.50102@emation.pt> Hi, I want to make sure my deployments have the same version of RXTX jar and native lib. I know the version of the jar can be obtained in the Version class, but how can I obtain the native version ? I know RXTX prints to the console a warning if the version is different. Is there a way to programatically know is this is the case ? I would like to log that to our app's log thanks Ricardo From taj at www.linux.org.uk Wed Apr 6 15:10:20 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 6 Apr 2005 22:10:20 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4253F346.50102@emation.pt> References: <4253F346.50102@emation.pt> Message-ID: On Wed, 6 Apr 2005, Ricardo Trindade wrote: > Hi, > > I want to make sure my deployments have the same version of RXTX jar > and native lib. > > I know the version of the jar can be obtained in the Version class, > but how can I obtain the native version ? > > I know RXTX prints to the console a warning if the version is > different. Is there a way to programatically know is this is the case ? > > I would like to log that to our app's log > There isn't a suggested way of doing that right now. We could move things around and have a static String RXTXVersion.getNativeVersion() in future releases. Is this what you expected? This is not documented in commapi at all. I just tossed that in to catch conflicts while developing. It would be nice to have access in GUI applications though. It may be possible to access RXTXCommDriver.LibVersion right now. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Thu Apr 7 02:51:00 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 09:51:00 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> Message-ID: <4254F474.7020905@emation.pt> >There isn't a suggested way of doing that right now. We could move things >around and have a static String RXTXVersion.getNativeVersion() in future >releases. Is this what you expected? > > Yes, that would be perfect. >This is not documented in commapi at all. I just tossed that in to catch >conflicts while developing. It would be nice to have access in GUI >applications though. > >It may be possible to access RXTXCommDriver.LibVersion right now. > > > I tried, and I don't think it's possible. From taj at www.linux.org.uk Thu Apr 7 03:32:04 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 7 Apr 2005 10:32:04 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4254F474.7020905@emation.pt> References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: On Thu, 7 Apr 2005, Ricardo Trindade wrote: > > >There isn't a suggested way of doing that right now. We could move things > >around and have a static String RXTXVersion.getNativeVersion() in future > >releases. Is this what you expected? > > > > > > Yes, that would be perfect. > The attached should do what you want. You will still need to catch an exception for older versions... -- Trent Jarvi taj at www.linux.org.uk -------------- next part -------------- ? public_version.patch Index: RXTXCommDriver.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXCommDriver.java,v retrieving revision 1.16.2.51 diff -u -r1.16.2.51 RXTXCommDriver.java --- RXTXCommDriver.java 12 Oct 2004 09:13:30 -0000 1.16.2.51 +++ RXTXCommDriver.java 7 Apr 2005 09:29:04 -0000 @@ -54,7 +54,7 @@ the Library. */ String JarVersion = RXTXVersion.getVersion(); - String LibVersion = nativeGetVersion(); + String LibVersion = RXTXVersion.nativeGetVersion(); if ( devel ) { System.out.println("Devel Library"); @@ -76,7 +76,6 @@ /** Get the Serial port prefixes for the running OS */ private String deviceDirectory; private String osName; - private static native String nativeGetVersion(); private native boolean registerKnownPorts(int PortType); private native boolean isPortPrefixValid(String dev); private native boolean testRead(String dev, int type); Index: RXTXVersion.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXVersion.java,v retrieving revision 1.2.2.31 diff -u -r1.2.2.31 RXTXVersion.java --- RXTXVersion.java 16 Oct 2004 16:20:35 -0000 1.2.2.31 +++ RXTXVersion.java 7 Apr 2005 09:29:04 -0000 @@ -36,6 +36,7 @@ private static String Version; static { + System.loadLibrary( "rxtxSerial" ); Version = "RXTX-2.1-7pre20"; } /** @@ -47,4 +48,5 @@ { return(Version); } + public static native String nativeGetVersion(); } Index: SerialImp.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v retrieving revision 1.46.2.181 diff -u -r1.46.2.181 SerialImp.c --- SerialImp.c 17 Oct 2004 09:48:56 -0000 1.46.2.181 +++ SerialImp.c 7 Apr 2005 09:29:07 -0000 @@ -116,6 +116,7 @@ * It will eventually be removed. * */ #define RXTXPort(foo) Java_gnu_io_RXTXPort_ ## foo +#define RXTXVersion(foo) Java_gnu_io_RXTXVersion_ ## foo #define RXTXCommDriver(foo) Java_gnu_io_RXTXCommDriver_ ## foo #if defined(__sun__) || defined(__hpux__) @@ -4001,7 +4002,7 @@ } /*---------------------------------------------------------- -RXTXCommDriver.nativeGetVersion +RXTXVersion.nativeGetVersion accept: none perform: return the current version @@ -4010,9 +4011,10 @@ comments: This is used to avoid mixing versions of the .jar and native library. First introduced in rxtx-1.5-9 + Moved from RXTXCommDriver to RXTXVersion in rxtx-2.1-7 ----------------------------------------------------------*/ -JNIEXPORT jstring JNICALL RXTXCommDriver(nativeGetVersion) (JNIEnv *env, +JNIEXPORT jstring JNICALL RXTXVersion(nativeGetVersion) (JNIEnv *env, jclass jclazz ) { return (*env)->NewStringUTF( env, "RXTX-2.1-7pre20" ); From ricardo.trindade at emation.pt Thu Apr 7 03:45:58 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 10:45:58 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: <42550156.2040908@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050407/05212451/attachment-0096.html From thomas.shulok at lmco.com Thu Apr 7 17:43:11 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Thu, 07 Apr 2005 19:43:11 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi There, I'm attempting to talk RS232 between an embedded Linux box and a Windows box. Everything connects up fine, and I can send and receive a simple sequence of bytes with no problems. However, if around 5 seconds goes by without me sending something, I get the following when I attempt to send. java.io.IOException: Input/output error in writeArray Stack trace: java/lang/Throwable.()V java/lang/Throwable.(Ljava/lang/String;)V java/io/IOException.(Ljava/lang/String;)V gnu/io/RXTXPort.writeArray([BIIZ)V gnu/io/RXTXPort$SerialOutputStream.write([B)V SerialTest.main([Ljava/lang/String;)V If there interval is shorter (say 2 seconds between sends), I have no problems. On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and librxtxSerial-2.0.7pre2.so. Any ideas? Thanks, Thom -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5b23dcf/attachment-0096.html From taj at www.linux.org.uk Thu Apr 7 19:22:36 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:22:36 +0100 (BST) Subject: [Rxtx] Input/output error in writeArray In-Reply-To: References: Message-ID: On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a Windows > box. Everything connects up fine, and I can send and receive a simple > sequence of bytes with no problems. However, if around 5 seconds goes > by without me sending something, I get the following when I attempt to > send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Apr 7 19:24:59 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:24:59 +0100 (BST) Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) Message-ID: hmm. This would not work from applets would it? -- Trent Jarvi taj at www.linux.org.uk ---------- Forwarded message ---------- Date: Thu, 07 Apr 2005 16:05:53 -0400 From: Chris Gaffney To: taj at www.linux.org.uk Subject: RXTX Libraries on Classpath fix Hi, I submitted a patch for RXTX a few weeks ago to allow for loading the native libraries from the classpath. Since sending it to you I found it wasn't working on windows. I've fixed the problem and created a new patch that should replace the older one. The actual change is a one line from a String.equals() to a String.startsWith(). Thanks for a great piece of software, -Chris Gaffney Grand Valley State University -------------- next part -------------- A non-text attachment was scrubbed... Name: libraries_on_classpath_fixed.patch Type: text/x-patch Size: 5617 bytes Desc: Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5d423b8/libraries_on_classpath_fixed-0096.bin From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From thomas.shulok at lmco.com Fri Apr 8 10:38:55 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Fri, 08 Apr 2005 12:38:55 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi Trent, Thanks for the prompt response. Before diving deeper, I was wondering if there is a timeout parameter somewhere in the stack that I have not set properly. Given the nature of the failure (only fails if the line has been idle for a few seconds), it feels like some kind of timeout issue... Thanks again, Thom -----Original Message----- From: rxtx-bounces at mail.linuxgrrls.org [mailto:rxtx-bounces at mail.linuxgrrls.org] On Behalf Of Trent Jarvi Sent: Thursday, April 07, 2005 6:23 PM To: Java RXTX discussion Subject: Re: [Rxtx] Input/output error in writeArray On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a > Windows box. Everything connects up fine, and I can send and receive > a simple sequence of bytes with no problems. However, if around 5 > seconds goes by without me sending something, I get the following when > I attempt to send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at mail.linuxgrrls.org http://mail.linuxgrrls.org/mailman/listinfo/rxtx From ricardo.trindade at emation.pt Mon Apr 4 09:17:23 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Mon, 04 Apr 2005 16:17:23 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot Message-ID: <42515A83.4050907@emation.pt> Hi, I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most recent stable snapshot), and get the following exception : It looks like rxtx has been compiled with jdk 1.5. If this was indeed the case, I think there is a compilation flag that generates code that runs on older jdks. java.lang.UnsupportedClassVersionError: gnu/io/UnsupportedCommOperationException (Unsupported major.minor version 49.0) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at java.net.URLClassLoader.defineClass(URLClassLoader.java:251) at java.net.URLClassLoader.access$100(URLClassLoader.java:55) at java.net.URLClassLoader$1.run(URLClassLoader.java:194) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:187) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:141) I'm trying to run it with 1.4. thanks Ricardo From taj at www.linux.org.uk Tue Apr 5 00:48:12 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 07:48:12 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42515A83.4050907@emation.pt> References: <42515A83.4050907@emation.pt> Message-ID: On Mon, 4 Apr 2005, Ricardo Trindade wrote: > Hi, > > I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most > recent stable snapshot), and get the following exception : > > It looks like rxtx has been compiled with jdk 1.5. If this was > indeed the case, I think there is a compilation flag that generates code > that runs on older jdks. > > java.lang.UnsupportedClassVersionError: > gnu/io/UnsupportedCommOperationException (Unsupported major.minor > version 49.0) [snip] Thanks Ricardo I recompiled the jar with javac -source 1.3 -target 1.3. That should cover most of the JRE's in use today. I also compiled the rxtx 2.0 x86_64 native library which appeared to be missing. I tried looking for flags to pass gcc 4.0 to make the native libraries more backwards compatible but only found options for C++ which is not used in rxtx. I've got a list of other bugs that I'll be going through in the next few weeks but for now I just left them with the same CVS filename - no code changes. ftp://ftp.qbang.org/pub/rxtx/rxtx-2.0-CVS-20050120-bins.tar.gz ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-CVS-20050120-bins.tar.gz -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Tue Apr 5 02:24:33 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 05 Apr 2005 09:24:33 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: References: <42515A83.4050907@emation.pt> Message-ID: <42524B41.3040300@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050405/5919abbb/attachment-0097.html From taj at www.linux.org.uk Tue Apr 5 03:00:29 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 10:00:29 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42524B41.3040300@emation.pt> References: <42515A83.4050907@emation.pt> <42524B41.3040300@emation.pt> Message-ID: On Tue, 5 Apr 2005, Ricardo Trindade wrote: > Will you anounce to the list when a new release is available ? > There will be several incremental releases announced here. Once those are done, we will release 2.1.7 and 2.0.7. -- Trent Jarvi taj at www.linux.org.uk From no_spam at somewhere.com Tue Apr 5 11:55:37 2005 From: no_spam at somewhere.com (no_spam@somewhere.com) Date: Tue, 5 Apr 2005 13:55:37 -0400 Subject: [Rxtx] Closing a port from an event listener results in a deadlock Message-ID: <20050405175537.GA21747@rcog.homelinux.net> On the message I sent on March 14, does anyone had the chance to try the modification? Or was it already fixed? (I haven't searched the archive extensively) Or maybe my message got catched by some spam filters? (it made it to the list archive though) Anyway, I would appreciate some feedback (through the list) Thanks From taj at www.linux.org.uk Tue Apr 5 14:42:28 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 21:42:28 +0100 (BST) Subject: [Rxtx] Closing a port from an event listener results in a deadlock In-Reply-To: <20050405175537.GA21747@rcog.homelinux.net> References: <20050405175537.GA21747@rcog.homelinux.net> Message-ID: On Tue, 5 Apr 2005 no_spam at somewhere.com wrote: > On the message I sent on March 14, does anyone had the chance to try the > modification? > > Or was it already fixed? (I haven't searched the archive extensively) > > Or maybe my message got catched by some spam filters? (it made it to the list > archive though) > > Anyway, I would appreciate some feedback (through the list) > The patch is here http://marc.theaimsgroup.com/?l=rxtx&m=111084488820288&w=2 I have applied this patch to a local copy but will not be doing formal testing for a couple weeks. I do not try to close ports from inside the eventListenter usually so I encourage any feedback also. If there are no problems reported, I expect this will go into rxtx 2.1-7. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Wed Apr 6 08:33:42 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Wed, 06 Apr 2005 15:33:42 +0100 Subject: [Rxtx] getting RXTX version Message-ID: <4253F346.50102@emation.pt> Hi, I want to make sure my deployments have the same version of RXTX jar and native lib. I know the version of the jar can be obtained in the Version class, but how can I obtain the native version ? I know RXTX prints to the console a warning if the version is different. Is there a way to programatically know is this is the case ? I would like to log that to our app's log thanks Ricardo From taj at www.linux.org.uk Wed Apr 6 15:10:20 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 6 Apr 2005 22:10:20 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4253F346.50102@emation.pt> References: <4253F346.50102@emation.pt> Message-ID: On Wed, 6 Apr 2005, Ricardo Trindade wrote: > Hi, > > I want to make sure my deployments have the same version of RXTX jar > and native lib. > > I know the version of the jar can be obtained in the Version class, > but how can I obtain the native version ? > > I know RXTX prints to the console a warning if the version is > different. Is there a way to programatically know is this is the case ? > > I would like to log that to our app's log > There isn't a suggested way of doing that right now. We could move things around and have a static String RXTXVersion.getNativeVersion() in future releases. Is this what you expected? This is not documented in commapi at all. I just tossed that in to catch conflicts while developing. It would be nice to have access in GUI applications though. It may be possible to access RXTXCommDriver.LibVersion right now. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Thu Apr 7 02:51:00 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 09:51:00 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> Message-ID: <4254F474.7020905@emation.pt> >There isn't a suggested way of doing that right now. We could move things >around and have a static String RXTXVersion.getNativeVersion() in future >releases. Is this what you expected? > > Yes, that would be perfect. >This is not documented in commapi at all. I just tossed that in to catch >conflicts while developing. It would be nice to have access in GUI >applications though. > >It may be possible to access RXTXCommDriver.LibVersion right now. > > > I tried, and I don't think it's possible. From taj at www.linux.org.uk Thu Apr 7 03:32:04 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 7 Apr 2005 10:32:04 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4254F474.7020905@emation.pt> References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: On Thu, 7 Apr 2005, Ricardo Trindade wrote: > > >There isn't a suggested way of doing that right now. We could move things > >around and have a static String RXTXVersion.getNativeVersion() in future > >releases. Is this what you expected? > > > > > > Yes, that would be perfect. > The attached should do what you want. You will still need to catch an exception for older versions... -- Trent Jarvi taj at www.linux.org.uk -------------- next part -------------- ? public_version.patch Index: RXTXCommDriver.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXCommDriver.java,v retrieving revision 1.16.2.51 diff -u -r1.16.2.51 RXTXCommDriver.java --- RXTXCommDriver.java 12 Oct 2004 09:13:30 -0000 1.16.2.51 +++ RXTXCommDriver.java 7 Apr 2005 09:29:04 -0000 @@ -54,7 +54,7 @@ the Library. */ String JarVersion = RXTXVersion.getVersion(); - String LibVersion = nativeGetVersion(); + String LibVersion = RXTXVersion.nativeGetVersion(); if ( devel ) { System.out.println("Devel Library"); @@ -76,7 +76,6 @@ /** Get the Serial port prefixes for the running OS */ private String deviceDirectory; private String osName; - private static native String nativeGetVersion(); private native boolean registerKnownPorts(int PortType); private native boolean isPortPrefixValid(String dev); private native boolean testRead(String dev, int type); Index: RXTXVersion.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXVersion.java,v retrieving revision 1.2.2.31 diff -u -r1.2.2.31 RXTXVersion.java --- RXTXVersion.java 16 Oct 2004 16:20:35 -0000 1.2.2.31 +++ RXTXVersion.java 7 Apr 2005 09:29:04 -0000 @@ -36,6 +36,7 @@ private static String Version; static { + System.loadLibrary( "rxtxSerial" ); Version = "RXTX-2.1-7pre20"; } /** @@ -47,4 +48,5 @@ { return(Version); } + public static native String nativeGetVersion(); } Index: SerialImp.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v retrieving revision 1.46.2.181 diff -u -r1.46.2.181 SerialImp.c --- SerialImp.c 17 Oct 2004 09:48:56 -0000 1.46.2.181 +++ SerialImp.c 7 Apr 2005 09:29:07 -0000 @@ -116,6 +116,7 @@ * It will eventually be removed. * */ #define RXTXPort(foo) Java_gnu_io_RXTXPort_ ## foo +#define RXTXVersion(foo) Java_gnu_io_RXTXVersion_ ## foo #define RXTXCommDriver(foo) Java_gnu_io_RXTXCommDriver_ ## foo #if defined(__sun__) || defined(__hpux__) @@ -4001,7 +4002,7 @@ } /*---------------------------------------------------------- -RXTXCommDriver.nativeGetVersion +RXTXVersion.nativeGetVersion accept: none perform: return the current version @@ -4010,9 +4011,10 @@ comments: This is used to avoid mixing versions of the .jar and native library. First introduced in rxtx-1.5-9 + Moved from RXTXCommDriver to RXTXVersion in rxtx-2.1-7 ----------------------------------------------------------*/ -JNIEXPORT jstring JNICALL RXTXCommDriver(nativeGetVersion) (JNIEnv *env, +JNIEXPORT jstring JNICALL RXTXVersion(nativeGetVersion) (JNIEnv *env, jclass jclazz ) { return (*env)->NewStringUTF( env, "RXTX-2.1-7pre20" ); From ricardo.trindade at emation.pt Thu Apr 7 03:45:58 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 10:45:58 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: <42550156.2040908@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050407/05212451/attachment-0097.html From thomas.shulok at lmco.com Thu Apr 7 17:43:11 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Thu, 07 Apr 2005 19:43:11 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi There, I'm attempting to talk RS232 between an embedded Linux box and a Windows box. Everything connects up fine, and I can send and receive a simple sequence of bytes with no problems. However, if around 5 seconds goes by without me sending something, I get the following when I attempt to send. java.io.IOException: Input/output error in writeArray Stack trace: java/lang/Throwable.()V java/lang/Throwable.(Ljava/lang/String;)V java/io/IOException.(Ljava/lang/String;)V gnu/io/RXTXPort.writeArray([BIIZ)V gnu/io/RXTXPort$SerialOutputStream.write([B)V SerialTest.main([Ljava/lang/String;)V If there interval is shorter (say 2 seconds between sends), I have no problems. On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and librxtxSerial-2.0.7pre2.so. Any ideas? Thanks, Thom -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5b23dcf/attachment-0097.html From taj at www.linux.org.uk Thu Apr 7 19:22:36 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:22:36 +0100 (BST) Subject: [Rxtx] Input/output error in writeArray In-Reply-To: References: Message-ID: On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a Windows > box. Everything connects up fine, and I can send and receive a simple > sequence of bytes with no problems. However, if around 5 seconds goes > by without me sending something, I get the following when I attempt to > send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Apr 7 19:24:59 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:24:59 +0100 (BST) Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) Message-ID: hmm. This would not work from applets would it? -- Trent Jarvi taj at www.linux.org.uk ---------- Forwarded message ---------- Date: Thu, 07 Apr 2005 16:05:53 -0400 From: Chris Gaffney To: taj at www.linux.org.uk Subject: RXTX Libraries on Classpath fix Hi, I submitted a patch for RXTX a few weeks ago to allow for loading the native libraries from the classpath. Since sending it to you I found it wasn't working on windows. I've fixed the problem and created a new patch that should replace the older one. The actual change is a one line from a String.equals() to a String.startsWith(). Thanks for a great piece of software, -Chris Gaffney Grand Valley State University -------------- next part -------------- A non-text attachment was scrubbed... Name: libraries_on_classpath_fixed.patch Type: text/x-patch Size: 5617 bytes Desc: Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5d423b8/libraries_on_classpath_fixed-0097.bin From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From thomas.shulok at lmco.com Fri Apr 8 10:38:55 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Fri, 08 Apr 2005 12:38:55 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi Trent, Thanks for the prompt response. Before diving deeper, I was wondering if there is a timeout parameter somewhere in the stack that I have not set properly. Given the nature of the failure (only fails if the line has been idle for a few seconds), it feels like some kind of timeout issue... Thanks again, Thom -----Original Message----- From: rxtx-bounces at mail.linuxgrrls.org [mailto:rxtx-bounces at mail.linuxgrrls.org] On Behalf Of Trent Jarvi Sent: Thursday, April 07, 2005 6:23 PM To: Java RXTX discussion Subject: Re: [Rxtx] Input/output error in writeArray On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a > Windows box. Everything connects up fine, and I can send and receive > a simple sequence of bytes with no problems. However, if around 5 > seconds goes by without me sending something, I get the following when > I attempt to send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at mail.linuxgrrls.org http://mail.linuxgrrls.org/mailman/listinfo/rxtx From ricardo.trindade at emation.pt Mon Apr 4 09:17:23 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Mon, 04 Apr 2005 16:17:23 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot Message-ID: <42515A83.4050907@emation.pt> Hi, I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most recent stable snapshot), and get the following exception : It looks like rxtx has been compiled with jdk 1.5. If this was indeed the case, I think there is a compilation flag that generates code that runs on older jdks. java.lang.UnsupportedClassVersionError: gnu/io/UnsupportedCommOperationException (Unsupported major.minor version 49.0) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at java.net.URLClassLoader.defineClass(URLClassLoader.java:251) at java.net.URLClassLoader.access$100(URLClassLoader.java:55) at java.net.URLClassLoader$1.run(URLClassLoader.java:194) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:187) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:141) I'm trying to run it with 1.4. thanks Ricardo From taj at www.linux.org.uk Tue Apr 5 00:48:12 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 07:48:12 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42515A83.4050907@emation.pt> References: <42515A83.4050907@emation.pt> Message-ID: On Mon, 4 Apr 2005, Ricardo Trindade wrote: > Hi, > > I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most > recent stable snapshot), and get the following exception : > > It looks like rxtx has been compiled with jdk 1.5. If this was > indeed the case, I think there is a compilation flag that generates code > that runs on older jdks. > > java.lang.UnsupportedClassVersionError: > gnu/io/UnsupportedCommOperationException (Unsupported major.minor > version 49.0) [snip] Thanks Ricardo I recompiled the jar with javac -source 1.3 -target 1.3. That should cover most of the JRE's in use today. I also compiled the rxtx 2.0 x86_64 native library which appeared to be missing. I tried looking for flags to pass gcc 4.0 to make the native libraries more backwards compatible but only found options for C++ which is not used in rxtx. I've got a list of other bugs that I'll be going through in the next few weeks but for now I just left them with the same CVS filename - no code changes. ftp://ftp.qbang.org/pub/rxtx/rxtx-2.0-CVS-20050120-bins.tar.gz ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-CVS-20050120-bins.tar.gz -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Tue Apr 5 02:24:33 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 05 Apr 2005 09:24:33 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: References: <42515A83.4050907@emation.pt> Message-ID: <42524B41.3040300@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050405/5919abbb/attachment-0098.html From taj at www.linux.org.uk Tue Apr 5 03:00:29 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 10:00:29 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42524B41.3040300@emation.pt> References: <42515A83.4050907@emation.pt> <42524B41.3040300@emation.pt> Message-ID: On Tue, 5 Apr 2005, Ricardo Trindade wrote: > Will you anounce to the list when a new release is available ? > There will be several incremental releases announced here. Once those are done, we will release 2.1.7 and 2.0.7. -- Trent Jarvi taj at www.linux.org.uk From no_spam at somewhere.com Tue Apr 5 11:55:37 2005 From: no_spam at somewhere.com (no_spam@somewhere.com) Date: Tue, 5 Apr 2005 13:55:37 -0400 Subject: [Rxtx] Closing a port from an event listener results in a deadlock Message-ID: <20050405175537.GA21747@rcog.homelinux.net> On the message I sent on March 14, does anyone had the chance to try the modification? Or was it already fixed? (I haven't searched the archive extensively) Or maybe my message got catched by some spam filters? (it made it to the list archive though) Anyway, I would appreciate some feedback (through the list) Thanks From taj at www.linux.org.uk Tue Apr 5 14:42:28 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 21:42:28 +0100 (BST) Subject: [Rxtx] Closing a port from an event listener results in a deadlock In-Reply-To: <20050405175537.GA21747@rcog.homelinux.net> References: <20050405175537.GA21747@rcog.homelinux.net> Message-ID: On Tue, 5 Apr 2005 no_spam at somewhere.com wrote: > On the message I sent on March 14, does anyone had the chance to try the > modification? > > Or was it already fixed? (I haven't searched the archive extensively) > > Or maybe my message got catched by some spam filters? (it made it to the list > archive though) > > Anyway, I would appreciate some feedback (through the list) > The patch is here http://marc.theaimsgroup.com/?l=rxtx&m=111084488820288&w=2 I have applied this patch to a local copy but will not be doing formal testing for a couple weeks. I do not try to close ports from inside the eventListenter usually so I encourage any feedback also. If there are no problems reported, I expect this will go into rxtx 2.1-7. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Wed Apr 6 08:33:42 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Wed, 06 Apr 2005 15:33:42 +0100 Subject: [Rxtx] getting RXTX version Message-ID: <4253F346.50102@emation.pt> Hi, I want to make sure my deployments have the same version of RXTX jar and native lib. I know the version of the jar can be obtained in the Version class, but how can I obtain the native version ? I know RXTX prints to the console a warning if the version is different. Is there a way to programatically know is this is the case ? I would like to log that to our app's log thanks Ricardo From taj at www.linux.org.uk Wed Apr 6 15:10:20 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 6 Apr 2005 22:10:20 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4253F346.50102@emation.pt> References: <4253F346.50102@emation.pt> Message-ID: On Wed, 6 Apr 2005, Ricardo Trindade wrote: > Hi, > > I want to make sure my deployments have the same version of RXTX jar > and native lib. > > I know the version of the jar can be obtained in the Version class, > but how can I obtain the native version ? > > I know RXTX prints to the console a warning if the version is > different. Is there a way to programatically know is this is the case ? > > I would like to log that to our app's log > There isn't a suggested way of doing that right now. We could move things around and have a static String RXTXVersion.getNativeVersion() in future releases. Is this what you expected? This is not documented in commapi at all. I just tossed that in to catch conflicts while developing. It would be nice to have access in GUI applications though. It may be possible to access RXTXCommDriver.LibVersion right now. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Thu Apr 7 02:51:00 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 09:51:00 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> Message-ID: <4254F474.7020905@emation.pt> >There isn't a suggested way of doing that right now. We could move things >around and have a static String RXTXVersion.getNativeVersion() in future >releases. Is this what you expected? > > Yes, that would be perfect. >This is not documented in commapi at all. I just tossed that in to catch >conflicts while developing. It would be nice to have access in GUI >applications though. > >It may be possible to access RXTXCommDriver.LibVersion right now. > > > I tried, and I don't think it's possible. From taj at www.linux.org.uk Thu Apr 7 03:32:04 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 7 Apr 2005 10:32:04 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4254F474.7020905@emation.pt> References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: On Thu, 7 Apr 2005, Ricardo Trindade wrote: > > >There isn't a suggested way of doing that right now. We could move things > >around and have a static String RXTXVersion.getNativeVersion() in future > >releases. Is this what you expected? > > > > > > Yes, that would be perfect. > The attached should do what you want. You will still need to catch an exception for older versions... -- Trent Jarvi taj at www.linux.org.uk -------------- next part -------------- ? public_version.patch Index: RXTXCommDriver.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXCommDriver.java,v retrieving revision 1.16.2.51 diff -u -r1.16.2.51 RXTXCommDriver.java --- RXTXCommDriver.java 12 Oct 2004 09:13:30 -0000 1.16.2.51 +++ RXTXCommDriver.java 7 Apr 2005 09:29:04 -0000 @@ -54,7 +54,7 @@ the Library. */ String JarVersion = RXTXVersion.getVersion(); - String LibVersion = nativeGetVersion(); + String LibVersion = RXTXVersion.nativeGetVersion(); if ( devel ) { System.out.println("Devel Library"); @@ -76,7 +76,6 @@ /** Get the Serial port prefixes for the running OS */ private String deviceDirectory; private String osName; - private static native String nativeGetVersion(); private native boolean registerKnownPorts(int PortType); private native boolean isPortPrefixValid(String dev); private native boolean testRead(String dev, int type); Index: RXTXVersion.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXVersion.java,v retrieving revision 1.2.2.31 diff -u -r1.2.2.31 RXTXVersion.java --- RXTXVersion.java 16 Oct 2004 16:20:35 -0000 1.2.2.31 +++ RXTXVersion.java 7 Apr 2005 09:29:04 -0000 @@ -36,6 +36,7 @@ private static String Version; static { + System.loadLibrary( "rxtxSerial" ); Version = "RXTX-2.1-7pre20"; } /** @@ -47,4 +48,5 @@ { return(Version); } + public static native String nativeGetVersion(); } Index: SerialImp.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v retrieving revision 1.46.2.181 diff -u -r1.46.2.181 SerialImp.c --- SerialImp.c 17 Oct 2004 09:48:56 -0000 1.46.2.181 +++ SerialImp.c 7 Apr 2005 09:29:07 -0000 @@ -116,6 +116,7 @@ * It will eventually be removed. * */ #define RXTXPort(foo) Java_gnu_io_RXTXPort_ ## foo +#define RXTXVersion(foo) Java_gnu_io_RXTXVersion_ ## foo #define RXTXCommDriver(foo) Java_gnu_io_RXTXCommDriver_ ## foo #if defined(__sun__) || defined(__hpux__) @@ -4001,7 +4002,7 @@ } /*---------------------------------------------------------- -RXTXCommDriver.nativeGetVersion +RXTXVersion.nativeGetVersion accept: none perform: return the current version @@ -4010,9 +4011,10 @@ comments: This is used to avoid mixing versions of the .jar and native library. First introduced in rxtx-1.5-9 + Moved from RXTXCommDriver to RXTXVersion in rxtx-2.1-7 ----------------------------------------------------------*/ -JNIEXPORT jstring JNICALL RXTXCommDriver(nativeGetVersion) (JNIEnv *env, +JNIEXPORT jstring JNICALL RXTXVersion(nativeGetVersion) (JNIEnv *env, jclass jclazz ) { return (*env)->NewStringUTF( env, "RXTX-2.1-7pre20" ); From ricardo.trindade at emation.pt Thu Apr 7 03:45:58 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 10:45:58 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: <42550156.2040908@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050407/05212451/attachment-0098.html From thomas.shulok at lmco.com Thu Apr 7 17:43:11 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Thu, 07 Apr 2005 19:43:11 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi There, I'm attempting to talk RS232 between an embedded Linux box and a Windows box. Everything connects up fine, and I can send and receive a simple sequence of bytes with no problems. However, if around 5 seconds goes by without me sending something, I get the following when I attempt to send. java.io.IOException: Input/output error in writeArray Stack trace: java/lang/Throwable.()V java/lang/Throwable.(Ljava/lang/String;)V java/io/IOException.(Ljava/lang/String;)V gnu/io/RXTXPort.writeArray([BIIZ)V gnu/io/RXTXPort$SerialOutputStream.write([B)V SerialTest.main([Ljava/lang/String;)V If there interval is shorter (say 2 seconds between sends), I have no problems. On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and librxtxSerial-2.0.7pre2.so. Any ideas? Thanks, Thom -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5b23dcf/attachment-0098.html From taj at www.linux.org.uk Thu Apr 7 19:22:36 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:22:36 +0100 (BST) Subject: [Rxtx] Input/output error in writeArray In-Reply-To: References: Message-ID: On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a Windows > box. Everything connects up fine, and I can send and receive a simple > sequence of bytes with no problems. However, if around 5 seconds goes > by without me sending something, I get the following when I attempt to > send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Apr 7 19:24:59 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:24:59 +0100 (BST) Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) Message-ID: hmm. This would not work from applets would it? -- Trent Jarvi taj at www.linux.org.uk ---------- Forwarded message ---------- Date: Thu, 07 Apr 2005 16:05:53 -0400 From: Chris Gaffney To: taj at www.linux.org.uk Subject: RXTX Libraries on Classpath fix Hi, I submitted a patch for RXTX a few weeks ago to allow for loading the native libraries from the classpath. Since sending it to you I found it wasn't working on windows. I've fixed the problem and created a new patch that should replace the older one. The actual change is a one line from a String.equals() to a String.startsWith(). Thanks for a great piece of software, -Chris Gaffney Grand Valley State University -------------- next part -------------- A non-text attachment was scrubbed... Name: libraries_on_classpath_fixed.patch Type: text/x-patch Size: 5617 bytes Desc: Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5d423b8/libraries_on_classpath_fixed-0098.bin From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From thomas.shulok at lmco.com Fri Apr 8 10:38:55 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Fri, 08 Apr 2005 12:38:55 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi Trent, Thanks for the prompt response. Before diving deeper, I was wondering if there is a timeout parameter somewhere in the stack that I have not set properly. Given the nature of the failure (only fails if the line has been idle for a few seconds), it feels like some kind of timeout issue... Thanks again, Thom -----Original Message----- From: rxtx-bounces at mail.linuxgrrls.org [mailto:rxtx-bounces at mail.linuxgrrls.org] On Behalf Of Trent Jarvi Sent: Thursday, April 07, 2005 6:23 PM To: Java RXTX discussion Subject: Re: [Rxtx] Input/output error in writeArray On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a > Windows box. Everything connects up fine, and I can send and receive > a simple sequence of bytes with no problems. However, if around 5 > seconds goes by without me sending something, I get the following when > I attempt to send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at mail.linuxgrrls.org http://mail.linuxgrrls.org/mailman/listinfo/rxtx From ricardo.trindade at emation.pt Mon Apr 4 09:17:23 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Mon, 04 Apr 2005 16:17:23 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot Message-ID: <42515A83.4050907@emation.pt> Hi, I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most recent stable snapshot), and get the following exception : It looks like rxtx has been compiled with jdk 1.5. If this was indeed the case, I think there is a compilation flag that generates code that runs on older jdks. java.lang.UnsupportedClassVersionError: gnu/io/UnsupportedCommOperationException (Unsupported major.minor version 49.0) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at java.net.URLClassLoader.defineClass(URLClassLoader.java:251) at java.net.URLClassLoader.access$100(URLClassLoader.java:55) at java.net.URLClassLoader$1.run(URLClassLoader.java:194) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:187) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:141) I'm trying to run it with 1.4. thanks Ricardo From taj at www.linux.org.uk Tue Apr 5 00:48:12 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 07:48:12 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42515A83.4050907@emation.pt> References: <42515A83.4050907@emation.pt> Message-ID: On Mon, 4 Apr 2005, Ricardo Trindade wrote: > Hi, > > I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most > recent stable snapshot), and get the following exception : > > It looks like rxtx has been compiled with jdk 1.5. If this was > indeed the case, I think there is a compilation flag that generates code > that runs on older jdks. > > java.lang.UnsupportedClassVersionError: > gnu/io/UnsupportedCommOperationException (Unsupported major.minor > version 49.0) [snip] Thanks Ricardo I recompiled the jar with javac -source 1.3 -target 1.3. That should cover most of the JRE's in use today. I also compiled the rxtx 2.0 x86_64 native library which appeared to be missing. I tried looking for flags to pass gcc 4.0 to make the native libraries more backwards compatible but only found options for C++ which is not used in rxtx. I've got a list of other bugs that I'll be going through in the next few weeks but for now I just left them with the same CVS filename - no code changes. ftp://ftp.qbang.org/pub/rxtx/rxtx-2.0-CVS-20050120-bins.tar.gz ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-CVS-20050120-bins.tar.gz -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Tue Apr 5 02:24:33 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 05 Apr 2005 09:24:33 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: References: <42515A83.4050907@emation.pt> Message-ID: <42524B41.3040300@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050405/5919abbb/attachment-0099.html From taj at www.linux.org.uk Tue Apr 5 03:00:29 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 10:00:29 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42524B41.3040300@emation.pt> References: <42515A83.4050907@emation.pt> <42524B41.3040300@emation.pt> Message-ID: On Tue, 5 Apr 2005, Ricardo Trindade wrote: > Will you anounce to the list when a new release is available ? > There will be several incremental releases announced here. Once those are done, we will release 2.1.7 and 2.0.7. -- Trent Jarvi taj at www.linux.org.uk From no_spam at somewhere.com Tue Apr 5 11:55:37 2005 From: no_spam at somewhere.com (no_spam@somewhere.com) Date: Tue, 5 Apr 2005 13:55:37 -0400 Subject: [Rxtx] Closing a port from an event listener results in a deadlock Message-ID: <20050405175537.GA21747@rcog.homelinux.net> On the message I sent on March 14, does anyone had the chance to try the modification? Or was it already fixed? (I haven't searched the archive extensively) Or maybe my message got catched by some spam filters? (it made it to the list archive though) Anyway, I would appreciate some feedback (through the list) Thanks From taj at www.linux.org.uk Tue Apr 5 14:42:28 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 21:42:28 +0100 (BST) Subject: [Rxtx] Closing a port from an event listener results in a deadlock In-Reply-To: <20050405175537.GA21747@rcog.homelinux.net> References: <20050405175537.GA21747@rcog.homelinux.net> Message-ID: On Tue, 5 Apr 2005 no_spam at somewhere.com wrote: > On the message I sent on March 14, does anyone had the chance to try the > modification? > > Or was it already fixed? (I haven't searched the archive extensively) > > Or maybe my message got catched by some spam filters? (it made it to the list > archive though) > > Anyway, I would appreciate some feedback (through the list) > The patch is here http://marc.theaimsgroup.com/?l=rxtx&m=111084488820288&w=2 I have applied this patch to a local copy but will not be doing formal testing for a couple weeks. I do not try to close ports from inside the eventListenter usually so I encourage any feedback also. If there are no problems reported, I expect this will go into rxtx 2.1-7. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Wed Apr 6 08:33:42 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Wed, 06 Apr 2005 15:33:42 +0100 Subject: [Rxtx] getting RXTX version Message-ID: <4253F346.50102@emation.pt> Hi, I want to make sure my deployments have the same version of RXTX jar and native lib. I know the version of the jar can be obtained in the Version class, but how can I obtain the native version ? I know RXTX prints to the console a warning if the version is different. Is there a way to programatically know is this is the case ? I would like to log that to our app's log thanks Ricardo From taj at www.linux.org.uk Wed Apr 6 15:10:20 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 6 Apr 2005 22:10:20 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4253F346.50102@emation.pt> References: <4253F346.50102@emation.pt> Message-ID: On Wed, 6 Apr 2005, Ricardo Trindade wrote: > Hi, > > I want to make sure my deployments have the same version of RXTX jar > and native lib. > > I know the version of the jar can be obtained in the Version class, > but how can I obtain the native version ? > > I know RXTX prints to the console a warning if the version is > different. Is there a way to programatically know is this is the case ? > > I would like to log that to our app's log > There isn't a suggested way of doing that right now. We could move things around and have a static String RXTXVersion.getNativeVersion() in future releases. Is this what you expected? This is not documented in commapi at all. I just tossed that in to catch conflicts while developing. It would be nice to have access in GUI applications though. It may be possible to access RXTXCommDriver.LibVersion right now. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Thu Apr 7 02:51:00 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 09:51:00 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> Message-ID: <4254F474.7020905@emation.pt> >There isn't a suggested way of doing that right now. We could move things >around and have a static String RXTXVersion.getNativeVersion() in future >releases. Is this what you expected? > > Yes, that would be perfect. >This is not documented in commapi at all. I just tossed that in to catch >conflicts while developing. It would be nice to have access in GUI >applications though. > >It may be possible to access RXTXCommDriver.LibVersion right now. > > > I tried, and I don't think it's possible. From taj at www.linux.org.uk Thu Apr 7 03:32:04 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 7 Apr 2005 10:32:04 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4254F474.7020905@emation.pt> References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: On Thu, 7 Apr 2005, Ricardo Trindade wrote: > > >There isn't a suggested way of doing that right now. We could move things > >around and have a static String RXTXVersion.getNativeVersion() in future > >releases. Is this what you expected? > > > > > > Yes, that would be perfect. > The attached should do what you want. You will still need to catch an exception for older versions... -- Trent Jarvi taj at www.linux.org.uk -------------- next part -------------- ? public_version.patch Index: RXTXCommDriver.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXCommDriver.java,v retrieving revision 1.16.2.51 diff -u -r1.16.2.51 RXTXCommDriver.java --- RXTXCommDriver.java 12 Oct 2004 09:13:30 -0000 1.16.2.51 +++ RXTXCommDriver.java 7 Apr 2005 09:29:04 -0000 @@ -54,7 +54,7 @@ the Library. */ String JarVersion = RXTXVersion.getVersion(); - String LibVersion = nativeGetVersion(); + String LibVersion = RXTXVersion.nativeGetVersion(); if ( devel ) { System.out.println("Devel Library"); @@ -76,7 +76,6 @@ /** Get the Serial port prefixes for the running OS */ private String deviceDirectory; private String osName; - private static native String nativeGetVersion(); private native boolean registerKnownPorts(int PortType); private native boolean isPortPrefixValid(String dev); private native boolean testRead(String dev, int type); Index: RXTXVersion.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXVersion.java,v retrieving revision 1.2.2.31 diff -u -r1.2.2.31 RXTXVersion.java --- RXTXVersion.java 16 Oct 2004 16:20:35 -0000 1.2.2.31 +++ RXTXVersion.java 7 Apr 2005 09:29:04 -0000 @@ -36,6 +36,7 @@ private static String Version; static { + System.loadLibrary( "rxtxSerial" ); Version = "RXTX-2.1-7pre20"; } /** @@ -47,4 +48,5 @@ { return(Version); } + public static native String nativeGetVersion(); } Index: SerialImp.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v retrieving revision 1.46.2.181 diff -u -r1.46.2.181 SerialImp.c --- SerialImp.c 17 Oct 2004 09:48:56 -0000 1.46.2.181 +++ SerialImp.c 7 Apr 2005 09:29:07 -0000 @@ -116,6 +116,7 @@ * It will eventually be removed. * */ #define RXTXPort(foo) Java_gnu_io_RXTXPort_ ## foo +#define RXTXVersion(foo) Java_gnu_io_RXTXVersion_ ## foo #define RXTXCommDriver(foo) Java_gnu_io_RXTXCommDriver_ ## foo #if defined(__sun__) || defined(__hpux__) @@ -4001,7 +4002,7 @@ } /*---------------------------------------------------------- -RXTXCommDriver.nativeGetVersion +RXTXVersion.nativeGetVersion accept: none perform: return the current version @@ -4010,9 +4011,10 @@ comments: This is used to avoid mixing versions of the .jar and native library. First introduced in rxtx-1.5-9 + Moved from RXTXCommDriver to RXTXVersion in rxtx-2.1-7 ----------------------------------------------------------*/ -JNIEXPORT jstring JNICALL RXTXCommDriver(nativeGetVersion) (JNIEnv *env, +JNIEXPORT jstring JNICALL RXTXVersion(nativeGetVersion) (JNIEnv *env, jclass jclazz ) { return (*env)->NewStringUTF( env, "RXTX-2.1-7pre20" ); From ricardo.trindade at emation.pt Thu Apr 7 03:45:58 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 10:45:58 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: <42550156.2040908@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050407/05212451/attachment-0099.html From thomas.shulok at lmco.com Thu Apr 7 17:43:11 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Thu, 07 Apr 2005 19:43:11 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi There, I'm attempting to talk RS232 between an embedded Linux box and a Windows box. Everything connects up fine, and I can send and receive a simple sequence of bytes with no problems. However, if around 5 seconds goes by without me sending something, I get the following when I attempt to send. java.io.IOException: Input/output error in writeArray Stack trace: java/lang/Throwable.()V java/lang/Throwable.(Ljava/lang/String;)V java/io/IOException.(Ljava/lang/String;)V gnu/io/RXTXPort.writeArray([BIIZ)V gnu/io/RXTXPort$SerialOutputStream.write([B)V SerialTest.main([Ljava/lang/String;)V If there interval is shorter (say 2 seconds between sends), I have no problems. On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and librxtxSerial-2.0.7pre2.so. Any ideas? Thanks, Thom -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5b23dcf/attachment-0099.html From taj at www.linux.org.uk Thu Apr 7 19:22:36 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:22:36 +0100 (BST) Subject: [Rxtx] Input/output error in writeArray In-Reply-To: References: Message-ID: On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a Windows > box. Everything connects up fine, and I can send and receive a simple > sequence of bytes with no problems. However, if around 5 seconds goes > by without me sending something, I get the following when I attempt to > send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Apr 7 19:24:59 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:24:59 +0100 (BST) Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) Message-ID: hmm. This would not work from applets would it? -- Trent Jarvi taj at www.linux.org.uk ---------- Forwarded message ---------- Date: Thu, 07 Apr 2005 16:05:53 -0400 From: Chris Gaffney To: taj at www.linux.org.uk Subject: RXTX Libraries on Classpath fix Hi, I submitted a patch for RXTX a few weeks ago to allow for loading the native libraries from the classpath. Since sending it to you I found it wasn't working on windows. I've fixed the problem and created a new patch that should replace the older one. The actual change is a one line from a String.equals() to a String.startsWith(). Thanks for a great piece of software, -Chris Gaffney Grand Valley State University -------------- next part -------------- A non-text attachment was scrubbed... Name: libraries_on_classpath_fixed.patch Type: text/x-patch Size: 5617 bytes Desc: Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5d423b8/libraries_on_classpath_fixed-0099.bin From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From thomas.shulok at lmco.com Fri Apr 8 10:38:55 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Fri, 08 Apr 2005 12:38:55 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi Trent, Thanks for the prompt response. Before diving deeper, I was wondering if there is a timeout parameter somewhere in the stack that I have not set properly. Given the nature of the failure (only fails if the line has been idle for a few seconds), it feels like some kind of timeout issue... Thanks again, Thom -----Original Message----- From: rxtx-bounces at mail.linuxgrrls.org [mailto:rxtx-bounces at mail.linuxgrrls.org] On Behalf Of Trent Jarvi Sent: Thursday, April 07, 2005 6:23 PM To: Java RXTX discussion Subject: Re: [Rxtx] Input/output error in writeArray On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a > Windows box. Everything connects up fine, and I can send and receive > a simple sequence of bytes with no problems. However, if around 5 > seconds goes by without me sending something, I get the following when > I attempt to send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at mail.linuxgrrls.org http://mail.linuxgrrls.org/mailman/listinfo/rxtx From ricardo.trindade at emation.pt Mon Apr 4 09:17:23 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Mon, 04 Apr 2005 16:17:23 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot Message-ID: <42515A83.4050907@emation.pt> Hi, I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most recent stable snapshot), and get the following exception : It looks like rxtx has been compiled with jdk 1.5. If this was indeed the case, I think there is a compilation flag that generates code that runs on older jdks. java.lang.UnsupportedClassVersionError: gnu/io/UnsupportedCommOperationException (Unsupported major.minor version 49.0) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at java.net.URLClassLoader.defineClass(URLClassLoader.java:251) at java.net.URLClassLoader.access$100(URLClassLoader.java:55) at java.net.URLClassLoader$1.run(URLClassLoader.java:194) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:187) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:141) I'm trying to run it with 1.4. thanks Ricardo From taj at www.linux.org.uk Tue Apr 5 00:48:12 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 07:48:12 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42515A83.4050907@emation.pt> References: <42515A83.4050907@emation.pt> Message-ID: On Mon, 4 Apr 2005, Ricardo Trindade wrote: > Hi, > > I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most > recent stable snapshot), and get the following exception : > > It looks like rxtx has been compiled with jdk 1.5. If this was > indeed the case, I think there is a compilation flag that generates code > that runs on older jdks. > > java.lang.UnsupportedClassVersionError: > gnu/io/UnsupportedCommOperationException (Unsupported major.minor > version 49.0) [snip] Thanks Ricardo I recompiled the jar with javac -source 1.3 -target 1.3. That should cover most of the JRE's in use today. I also compiled the rxtx 2.0 x86_64 native library which appeared to be missing. I tried looking for flags to pass gcc 4.0 to make the native libraries more backwards compatible but only found options for C++ which is not used in rxtx. I've got a list of other bugs that I'll be going through in the next few weeks but for now I just left them with the same CVS filename - no code changes. ftp://ftp.qbang.org/pub/rxtx/rxtx-2.0-CVS-20050120-bins.tar.gz ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-CVS-20050120-bins.tar.gz -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Tue Apr 5 02:24:33 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 05 Apr 2005 09:24:33 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: References: <42515A83.4050907@emation.pt> Message-ID: <42524B41.3040300@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050405/5919abbb/attachment-0100.html From taj at www.linux.org.uk Tue Apr 5 03:00:29 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 10:00:29 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42524B41.3040300@emation.pt> References: <42515A83.4050907@emation.pt> <42524B41.3040300@emation.pt> Message-ID: On Tue, 5 Apr 2005, Ricardo Trindade wrote: > Will you anounce to the list when a new release is available ? > There will be several incremental releases announced here. Once those are done, we will release 2.1.7 and 2.0.7. -- Trent Jarvi taj at www.linux.org.uk From no_spam at somewhere.com Tue Apr 5 11:55:37 2005 From: no_spam at somewhere.com (no_spam@somewhere.com) Date: Tue, 5 Apr 2005 13:55:37 -0400 Subject: [Rxtx] Closing a port from an event listener results in a deadlock Message-ID: <20050405175537.GA21747@rcog.homelinux.net> On the message I sent on March 14, does anyone had the chance to try the modification? Or was it already fixed? (I haven't searched the archive extensively) Or maybe my message got catched by some spam filters? (it made it to the list archive though) Anyway, I would appreciate some feedback (through the list) Thanks From taj at www.linux.org.uk Tue Apr 5 14:42:28 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 21:42:28 +0100 (BST) Subject: [Rxtx] Closing a port from an event listener results in a deadlock In-Reply-To: <20050405175537.GA21747@rcog.homelinux.net> References: <20050405175537.GA21747@rcog.homelinux.net> Message-ID: On Tue, 5 Apr 2005 no_spam at somewhere.com wrote: > On the message I sent on March 14, does anyone had the chance to try the > modification? > > Or was it already fixed? (I haven't searched the archive extensively) > > Or maybe my message got catched by some spam filters? (it made it to the list > archive though) > > Anyway, I would appreciate some feedback (through the list) > The patch is here http://marc.theaimsgroup.com/?l=rxtx&m=111084488820288&w=2 I have applied this patch to a local copy but will not be doing formal testing for a couple weeks. I do not try to close ports from inside the eventListenter usually so I encourage any feedback also. If there are no problems reported, I expect this will go into rxtx 2.1-7. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Wed Apr 6 08:33:42 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Wed, 06 Apr 2005 15:33:42 +0100 Subject: [Rxtx] getting RXTX version Message-ID: <4253F346.50102@emation.pt> Hi, I want to make sure my deployments have the same version of RXTX jar and native lib. I know the version of the jar can be obtained in the Version class, but how can I obtain the native version ? I know RXTX prints to the console a warning if the version is different. Is there a way to programatically know is this is the case ? I would like to log that to our app's log thanks Ricardo From taj at www.linux.org.uk Wed Apr 6 15:10:20 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 6 Apr 2005 22:10:20 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4253F346.50102@emation.pt> References: <4253F346.50102@emation.pt> Message-ID: On Wed, 6 Apr 2005, Ricardo Trindade wrote: > Hi, > > I want to make sure my deployments have the same version of RXTX jar > and native lib. > > I know the version of the jar can be obtained in the Version class, > but how can I obtain the native version ? > > I know RXTX prints to the console a warning if the version is > different. Is there a way to programatically know is this is the case ? > > I would like to log that to our app's log > There isn't a suggested way of doing that right now. We could move things around and have a static String RXTXVersion.getNativeVersion() in future releases. Is this what you expected? This is not documented in commapi at all. I just tossed that in to catch conflicts while developing. It would be nice to have access in GUI applications though. It may be possible to access RXTXCommDriver.LibVersion right now. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Thu Apr 7 02:51:00 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 09:51:00 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> Message-ID: <4254F474.7020905@emation.pt> >There isn't a suggested way of doing that right now. We could move things >around and have a static String RXTXVersion.getNativeVersion() in future >releases. Is this what you expected? > > Yes, that would be perfect. >This is not documented in commapi at all. I just tossed that in to catch >conflicts while developing. It would be nice to have access in GUI >applications though. > >It may be possible to access RXTXCommDriver.LibVersion right now. > > > I tried, and I don't think it's possible. From taj at www.linux.org.uk Thu Apr 7 03:32:04 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 7 Apr 2005 10:32:04 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4254F474.7020905@emation.pt> References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: On Thu, 7 Apr 2005, Ricardo Trindade wrote: > > >There isn't a suggested way of doing that right now. We could move things > >around and have a static String RXTXVersion.getNativeVersion() in future > >releases. Is this what you expected? > > > > > > Yes, that would be perfect. > The attached should do what you want. You will still need to catch an exception for older versions... -- Trent Jarvi taj at www.linux.org.uk -------------- next part -------------- ? public_version.patch Index: RXTXCommDriver.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXCommDriver.java,v retrieving revision 1.16.2.51 diff -u -r1.16.2.51 RXTXCommDriver.java --- RXTXCommDriver.java 12 Oct 2004 09:13:30 -0000 1.16.2.51 +++ RXTXCommDriver.java 7 Apr 2005 09:29:04 -0000 @@ -54,7 +54,7 @@ the Library. */ String JarVersion = RXTXVersion.getVersion(); - String LibVersion = nativeGetVersion(); + String LibVersion = RXTXVersion.nativeGetVersion(); if ( devel ) { System.out.println("Devel Library"); @@ -76,7 +76,6 @@ /** Get the Serial port prefixes for the running OS */ private String deviceDirectory; private String osName; - private static native String nativeGetVersion(); private native boolean registerKnownPorts(int PortType); private native boolean isPortPrefixValid(String dev); private native boolean testRead(String dev, int type); Index: RXTXVersion.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXVersion.java,v retrieving revision 1.2.2.31 diff -u -r1.2.2.31 RXTXVersion.java --- RXTXVersion.java 16 Oct 2004 16:20:35 -0000 1.2.2.31 +++ RXTXVersion.java 7 Apr 2005 09:29:04 -0000 @@ -36,6 +36,7 @@ private static String Version; static { + System.loadLibrary( "rxtxSerial" ); Version = "RXTX-2.1-7pre20"; } /** @@ -47,4 +48,5 @@ { return(Version); } + public static native String nativeGetVersion(); } Index: SerialImp.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v retrieving revision 1.46.2.181 diff -u -r1.46.2.181 SerialImp.c --- SerialImp.c 17 Oct 2004 09:48:56 -0000 1.46.2.181 +++ SerialImp.c 7 Apr 2005 09:29:07 -0000 @@ -116,6 +116,7 @@ * It will eventually be removed. * */ #define RXTXPort(foo) Java_gnu_io_RXTXPort_ ## foo +#define RXTXVersion(foo) Java_gnu_io_RXTXVersion_ ## foo #define RXTXCommDriver(foo) Java_gnu_io_RXTXCommDriver_ ## foo #if defined(__sun__) || defined(__hpux__) @@ -4001,7 +4002,7 @@ } /*---------------------------------------------------------- -RXTXCommDriver.nativeGetVersion +RXTXVersion.nativeGetVersion accept: none perform: return the current version @@ -4010,9 +4011,10 @@ comments: This is used to avoid mixing versions of the .jar and native library. First introduced in rxtx-1.5-9 + Moved from RXTXCommDriver to RXTXVersion in rxtx-2.1-7 ----------------------------------------------------------*/ -JNIEXPORT jstring JNICALL RXTXCommDriver(nativeGetVersion) (JNIEnv *env, +JNIEXPORT jstring JNICALL RXTXVersion(nativeGetVersion) (JNIEnv *env, jclass jclazz ) { return (*env)->NewStringUTF( env, "RXTX-2.1-7pre20" ); From ricardo.trindade at emation.pt Thu Apr 7 03:45:58 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 10:45:58 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: <42550156.2040908@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050407/05212451/attachment-0100.html From thomas.shulok at lmco.com Thu Apr 7 17:43:11 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Thu, 07 Apr 2005 19:43:11 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi There, I'm attempting to talk RS232 between an embedded Linux box and a Windows box. Everything connects up fine, and I can send and receive a simple sequence of bytes with no problems. However, if around 5 seconds goes by without me sending something, I get the following when I attempt to send. java.io.IOException: Input/output error in writeArray Stack trace: java/lang/Throwable.()V java/lang/Throwable.(Ljava/lang/String;)V java/io/IOException.(Ljava/lang/String;)V gnu/io/RXTXPort.writeArray([BIIZ)V gnu/io/RXTXPort$SerialOutputStream.write([B)V SerialTest.main([Ljava/lang/String;)V If there interval is shorter (say 2 seconds between sends), I have no problems. On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and librxtxSerial-2.0.7pre2.so. Any ideas? Thanks, Thom -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5b23dcf/attachment-0100.html From taj at www.linux.org.uk Thu Apr 7 19:22:36 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:22:36 +0100 (BST) Subject: [Rxtx] Input/output error in writeArray In-Reply-To: References: Message-ID: On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a Windows > box. Everything connects up fine, and I can send and receive a simple > sequence of bytes with no problems. However, if around 5 seconds goes > by without me sending something, I get the following when I attempt to > send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Apr 7 19:24:59 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:24:59 +0100 (BST) Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) Message-ID: hmm. This would not work from applets would it? -- Trent Jarvi taj at www.linux.org.uk ---------- Forwarded message ---------- Date: Thu, 07 Apr 2005 16:05:53 -0400 From: Chris Gaffney To: taj at www.linux.org.uk Subject: RXTX Libraries on Classpath fix Hi, I submitted a patch for RXTX a few weeks ago to allow for loading the native libraries from the classpath. Since sending it to you I found it wasn't working on windows. I've fixed the problem and created a new patch that should replace the older one. The actual change is a one line from a String.equals() to a String.startsWith(). Thanks for a great piece of software, -Chris Gaffney Grand Valley State University -------------- next part -------------- A non-text attachment was scrubbed... Name: libraries_on_classpath_fixed.patch Type: text/x-patch Size: 5617 bytes Desc: Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5d423b8/libraries_on_classpath_fixed-0100.bin From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From thomas.shulok at lmco.com Fri Apr 8 10:38:55 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Fri, 08 Apr 2005 12:38:55 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi Trent, Thanks for the prompt response. Before diving deeper, I was wondering if there is a timeout parameter somewhere in the stack that I have not set properly. Given the nature of the failure (only fails if the line has been idle for a few seconds), it feels like some kind of timeout issue... Thanks again, Thom -----Original Message----- From: rxtx-bounces at mail.linuxgrrls.org [mailto:rxtx-bounces at mail.linuxgrrls.org] On Behalf Of Trent Jarvi Sent: Thursday, April 07, 2005 6:23 PM To: Java RXTX discussion Subject: Re: [Rxtx] Input/output error in writeArray On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a > Windows box. Everything connects up fine, and I can send and receive > a simple sequence of bytes with no problems. However, if around 5 > seconds goes by without me sending something, I get the following when > I attempt to send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at mail.linuxgrrls.org http://mail.linuxgrrls.org/mailman/listinfo/rxtx From ricardo.trindade at emation.pt Mon Apr 4 09:17:23 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Mon, 04 Apr 2005 16:17:23 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot Message-ID: <42515A83.4050907@emation.pt> Hi, I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most recent stable snapshot), and get the following exception : It looks like rxtx has been compiled with jdk 1.5. If this was indeed the case, I think there is a compilation flag that generates code that runs on older jdks. java.lang.UnsupportedClassVersionError: gnu/io/UnsupportedCommOperationException (Unsupported major.minor version 49.0) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at java.net.URLClassLoader.defineClass(URLClassLoader.java:251) at java.net.URLClassLoader.access$100(URLClassLoader.java:55) at java.net.URLClassLoader$1.run(URLClassLoader.java:194) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:187) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:141) I'm trying to run it with 1.4. thanks Ricardo From taj at www.linux.org.uk Tue Apr 5 00:48:12 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 07:48:12 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42515A83.4050907@emation.pt> References: <42515A83.4050907@emation.pt> Message-ID: On Mon, 4 Apr 2005, Ricardo Trindade wrote: > Hi, > > I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most > recent stable snapshot), and get the following exception : > > It looks like rxtx has been compiled with jdk 1.5. If this was > indeed the case, I think there is a compilation flag that generates code > that runs on older jdks. > > java.lang.UnsupportedClassVersionError: > gnu/io/UnsupportedCommOperationException (Unsupported major.minor > version 49.0) [snip] Thanks Ricardo I recompiled the jar with javac -source 1.3 -target 1.3. That should cover most of the JRE's in use today. I also compiled the rxtx 2.0 x86_64 native library which appeared to be missing. I tried looking for flags to pass gcc 4.0 to make the native libraries more backwards compatible but only found options for C++ which is not used in rxtx. I've got a list of other bugs that I'll be going through in the next few weeks but for now I just left them with the same CVS filename - no code changes. ftp://ftp.qbang.org/pub/rxtx/rxtx-2.0-CVS-20050120-bins.tar.gz ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-CVS-20050120-bins.tar.gz -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Tue Apr 5 02:24:33 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 05 Apr 2005 09:24:33 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: References: <42515A83.4050907@emation.pt> Message-ID: <42524B41.3040300@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050405/5919abbb/attachment-0101.html From taj at www.linux.org.uk Tue Apr 5 03:00:29 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 10:00:29 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42524B41.3040300@emation.pt> References: <42515A83.4050907@emation.pt> <42524B41.3040300@emation.pt> Message-ID: On Tue, 5 Apr 2005, Ricardo Trindade wrote: > Will you anounce to the list when a new release is available ? > There will be several incremental releases announced here. Once those are done, we will release 2.1.7 and 2.0.7. -- Trent Jarvi taj at www.linux.org.uk From no_spam at somewhere.com Tue Apr 5 11:55:37 2005 From: no_spam at somewhere.com (no_spam@somewhere.com) Date: Tue, 5 Apr 2005 13:55:37 -0400 Subject: [Rxtx] Closing a port from an event listener results in a deadlock Message-ID: <20050405175537.GA21747@rcog.homelinux.net> On the message I sent on March 14, does anyone had the chance to try the modification? Or was it already fixed? (I haven't searched the archive extensively) Or maybe my message got catched by some spam filters? (it made it to the list archive though) Anyway, I would appreciate some feedback (through the list) Thanks From taj at www.linux.org.uk Tue Apr 5 14:42:28 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 21:42:28 +0100 (BST) Subject: [Rxtx] Closing a port from an event listener results in a deadlock In-Reply-To: <20050405175537.GA21747@rcog.homelinux.net> References: <20050405175537.GA21747@rcog.homelinux.net> Message-ID: On Tue, 5 Apr 2005 no_spam at somewhere.com wrote: > On the message I sent on March 14, does anyone had the chance to try the > modification? > > Or was it already fixed? (I haven't searched the archive extensively) > > Or maybe my message got catched by some spam filters? (it made it to the list > archive though) > > Anyway, I would appreciate some feedback (through the list) > The patch is here http://marc.theaimsgroup.com/?l=rxtx&m=111084488820288&w=2 I have applied this patch to a local copy but will not be doing formal testing for a couple weeks. I do not try to close ports from inside the eventListenter usually so I encourage any feedback also. If there are no problems reported, I expect this will go into rxtx 2.1-7. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Wed Apr 6 08:33:42 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Wed, 06 Apr 2005 15:33:42 +0100 Subject: [Rxtx] getting RXTX version Message-ID: <4253F346.50102@emation.pt> Hi, I want to make sure my deployments have the same version of RXTX jar and native lib. I know the version of the jar can be obtained in the Version class, but how can I obtain the native version ? I know RXTX prints to the console a warning if the version is different. Is there a way to programatically know is this is the case ? I would like to log that to our app's log thanks Ricardo From taj at www.linux.org.uk Wed Apr 6 15:10:20 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 6 Apr 2005 22:10:20 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4253F346.50102@emation.pt> References: <4253F346.50102@emation.pt> Message-ID: On Wed, 6 Apr 2005, Ricardo Trindade wrote: > Hi, > > I want to make sure my deployments have the same version of RXTX jar > and native lib. > > I know the version of the jar can be obtained in the Version class, > but how can I obtain the native version ? > > I know RXTX prints to the console a warning if the version is > different. Is there a way to programatically know is this is the case ? > > I would like to log that to our app's log > There isn't a suggested way of doing that right now. We could move things around and have a static String RXTXVersion.getNativeVersion() in future releases. Is this what you expected? This is not documented in commapi at all. I just tossed that in to catch conflicts while developing. It would be nice to have access in GUI applications though. It may be possible to access RXTXCommDriver.LibVersion right now. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Thu Apr 7 02:51:00 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 09:51:00 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> Message-ID: <4254F474.7020905@emation.pt> >There isn't a suggested way of doing that right now. We could move things >around and have a static String RXTXVersion.getNativeVersion() in future >releases. Is this what you expected? > > Yes, that would be perfect. >This is not documented in commapi at all. I just tossed that in to catch >conflicts while developing. It would be nice to have access in GUI >applications though. > >It may be possible to access RXTXCommDriver.LibVersion right now. > > > I tried, and I don't think it's possible. From taj at www.linux.org.uk Thu Apr 7 03:32:04 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 7 Apr 2005 10:32:04 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4254F474.7020905@emation.pt> References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: On Thu, 7 Apr 2005, Ricardo Trindade wrote: > > >There isn't a suggested way of doing that right now. We could move things > >around and have a static String RXTXVersion.getNativeVersion() in future > >releases. Is this what you expected? > > > > > > Yes, that would be perfect. > The attached should do what you want. You will still need to catch an exception for older versions... -- Trent Jarvi taj at www.linux.org.uk -------------- next part -------------- ? public_version.patch Index: RXTXCommDriver.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXCommDriver.java,v retrieving revision 1.16.2.51 diff -u -r1.16.2.51 RXTXCommDriver.java --- RXTXCommDriver.java 12 Oct 2004 09:13:30 -0000 1.16.2.51 +++ RXTXCommDriver.java 7 Apr 2005 09:29:04 -0000 @@ -54,7 +54,7 @@ the Library. */ String JarVersion = RXTXVersion.getVersion(); - String LibVersion = nativeGetVersion(); + String LibVersion = RXTXVersion.nativeGetVersion(); if ( devel ) { System.out.println("Devel Library"); @@ -76,7 +76,6 @@ /** Get the Serial port prefixes for the running OS */ private String deviceDirectory; private String osName; - private static native String nativeGetVersion(); private native boolean registerKnownPorts(int PortType); private native boolean isPortPrefixValid(String dev); private native boolean testRead(String dev, int type); Index: RXTXVersion.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXVersion.java,v retrieving revision 1.2.2.31 diff -u -r1.2.2.31 RXTXVersion.java --- RXTXVersion.java 16 Oct 2004 16:20:35 -0000 1.2.2.31 +++ RXTXVersion.java 7 Apr 2005 09:29:04 -0000 @@ -36,6 +36,7 @@ private static String Version; static { + System.loadLibrary( "rxtxSerial" ); Version = "RXTX-2.1-7pre20"; } /** @@ -47,4 +48,5 @@ { return(Version); } + public static native String nativeGetVersion(); } Index: SerialImp.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v retrieving revision 1.46.2.181 diff -u -r1.46.2.181 SerialImp.c --- SerialImp.c 17 Oct 2004 09:48:56 -0000 1.46.2.181 +++ SerialImp.c 7 Apr 2005 09:29:07 -0000 @@ -116,6 +116,7 @@ * It will eventually be removed. * */ #define RXTXPort(foo) Java_gnu_io_RXTXPort_ ## foo +#define RXTXVersion(foo) Java_gnu_io_RXTXVersion_ ## foo #define RXTXCommDriver(foo) Java_gnu_io_RXTXCommDriver_ ## foo #if defined(__sun__) || defined(__hpux__) @@ -4001,7 +4002,7 @@ } /*---------------------------------------------------------- -RXTXCommDriver.nativeGetVersion +RXTXVersion.nativeGetVersion accept: none perform: return the current version @@ -4010,9 +4011,10 @@ comments: This is used to avoid mixing versions of the .jar and native library. First introduced in rxtx-1.5-9 + Moved from RXTXCommDriver to RXTXVersion in rxtx-2.1-7 ----------------------------------------------------------*/ -JNIEXPORT jstring JNICALL RXTXCommDriver(nativeGetVersion) (JNIEnv *env, +JNIEXPORT jstring JNICALL RXTXVersion(nativeGetVersion) (JNIEnv *env, jclass jclazz ) { return (*env)->NewStringUTF( env, "RXTX-2.1-7pre20" ); From ricardo.trindade at emation.pt Thu Apr 7 03:45:58 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 10:45:58 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: <42550156.2040908@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050407/05212451/attachment-0101.html From thomas.shulok at lmco.com Thu Apr 7 17:43:11 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Thu, 07 Apr 2005 19:43:11 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi There, I'm attempting to talk RS232 between an embedded Linux box and a Windows box. Everything connects up fine, and I can send and receive a simple sequence of bytes with no problems. However, if around 5 seconds goes by without me sending something, I get the following when I attempt to send. java.io.IOException: Input/output error in writeArray Stack trace: java/lang/Throwable.()V java/lang/Throwable.(Ljava/lang/String;)V java/io/IOException.(Ljava/lang/String;)V gnu/io/RXTXPort.writeArray([BIIZ)V gnu/io/RXTXPort$SerialOutputStream.write([B)V SerialTest.main([Ljava/lang/String;)V If there interval is shorter (say 2 seconds between sends), I have no problems. On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and librxtxSerial-2.0.7pre2.so. Any ideas? Thanks, Thom -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5b23dcf/attachment-0101.html From taj at www.linux.org.uk Thu Apr 7 19:22:36 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:22:36 +0100 (BST) Subject: [Rxtx] Input/output error in writeArray In-Reply-To: References: Message-ID: On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a Windows > box. Everything connects up fine, and I can send and receive a simple > sequence of bytes with no problems. However, if around 5 seconds goes > by without me sending something, I get the following when I attempt to > send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Apr 7 19:24:59 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:24:59 +0100 (BST) Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) Message-ID: hmm. This would not work from applets would it? -- Trent Jarvi taj at www.linux.org.uk ---------- Forwarded message ---------- Date: Thu, 07 Apr 2005 16:05:53 -0400 From: Chris Gaffney To: taj at www.linux.org.uk Subject: RXTX Libraries on Classpath fix Hi, I submitted a patch for RXTX a few weeks ago to allow for loading the native libraries from the classpath. Since sending it to you I found it wasn't working on windows. I've fixed the problem and created a new patch that should replace the older one. The actual change is a one line from a String.equals() to a String.startsWith(). Thanks for a great piece of software, -Chris Gaffney Grand Valley State University -------------- next part -------------- A non-text attachment was scrubbed... Name: libraries_on_classpath_fixed.patch Type: text/x-patch Size: 5617 bytes Desc: Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5d423b8/libraries_on_classpath_fixed-0101.bin From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From thomas.shulok at lmco.com Fri Apr 8 10:38:55 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Fri, 08 Apr 2005 12:38:55 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi Trent, Thanks for the prompt response. Before diving deeper, I was wondering if there is a timeout parameter somewhere in the stack that I have not set properly. Given the nature of the failure (only fails if the line has been idle for a few seconds), it feels like some kind of timeout issue... Thanks again, Thom -----Original Message----- From: rxtx-bounces at mail.linuxgrrls.org [mailto:rxtx-bounces at mail.linuxgrrls.org] On Behalf Of Trent Jarvi Sent: Thursday, April 07, 2005 6:23 PM To: Java RXTX discussion Subject: Re: [Rxtx] Input/output error in writeArray On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a > Windows box. Everything connects up fine, and I can send and receive > a simple sequence of bytes with no problems. However, if around 5 > seconds goes by without me sending something, I get the following when > I attempt to send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at mail.linuxgrrls.org http://mail.linuxgrrls.org/mailman/listinfo/rxtx From ricardo.trindade at emation.pt Mon Apr 4 09:17:23 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Mon, 04 Apr 2005 16:17:23 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot Message-ID: <42515A83.4050907@emation.pt> Hi, I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most recent stable snapshot), and get the following exception : It looks like rxtx has been compiled with jdk 1.5. If this was indeed the case, I think there is a compilation flag that generates code that runs on older jdks. java.lang.UnsupportedClassVersionError: gnu/io/UnsupportedCommOperationException (Unsupported major.minor version 49.0) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at java.net.URLClassLoader.defineClass(URLClassLoader.java:251) at java.net.URLClassLoader.access$100(URLClassLoader.java:55) at java.net.URLClassLoader$1.run(URLClassLoader.java:194) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:187) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:141) I'm trying to run it with 1.4. thanks Ricardo From taj at www.linux.org.uk Tue Apr 5 00:48:12 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 07:48:12 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42515A83.4050907@emation.pt> References: <42515A83.4050907@emation.pt> Message-ID: On Mon, 4 Apr 2005, Ricardo Trindade wrote: > Hi, > > I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most > recent stable snapshot), and get the following exception : > > It looks like rxtx has been compiled with jdk 1.5. If this was > indeed the case, I think there is a compilation flag that generates code > that runs on older jdks. > > java.lang.UnsupportedClassVersionError: > gnu/io/UnsupportedCommOperationException (Unsupported major.minor > version 49.0) [snip] Thanks Ricardo I recompiled the jar with javac -source 1.3 -target 1.3. That should cover most of the JRE's in use today. I also compiled the rxtx 2.0 x86_64 native library which appeared to be missing. I tried looking for flags to pass gcc 4.0 to make the native libraries more backwards compatible but only found options for C++ which is not used in rxtx. I've got a list of other bugs that I'll be going through in the next few weeks but for now I just left them with the same CVS filename - no code changes. ftp://ftp.qbang.org/pub/rxtx/rxtx-2.0-CVS-20050120-bins.tar.gz ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-CVS-20050120-bins.tar.gz -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Tue Apr 5 02:24:33 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 05 Apr 2005 09:24:33 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: References: <42515A83.4050907@emation.pt> Message-ID: <42524B41.3040300@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050405/5919abbb/attachment-0102.html From taj at www.linux.org.uk Tue Apr 5 03:00:29 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 10:00:29 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42524B41.3040300@emation.pt> References: <42515A83.4050907@emation.pt> <42524B41.3040300@emation.pt> Message-ID: On Tue, 5 Apr 2005, Ricardo Trindade wrote: > Will you anounce to the list when a new release is available ? > There will be several incremental releases announced here. Once those are done, we will release 2.1.7 and 2.0.7. -- Trent Jarvi taj at www.linux.org.uk From no_spam at somewhere.com Tue Apr 5 11:55:37 2005 From: no_spam at somewhere.com (no_spam@somewhere.com) Date: Tue, 5 Apr 2005 13:55:37 -0400 Subject: [Rxtx] Closing a port from an event listener results in a deadlock Message-ID: <20050405175537.GA21747@rcog.homelinux.net> On the message I sent on March 14, does anyone had the chance to try the modification? Or was it already fixed? (I haven't searched the archive extensively) Or maybe my message got catched by some spam filters? (it made it to the list archive though) Anyway, I would appreciate some feedback (through the list) Thanks From taj at www.linux.org.uk Tue Apr 5 14:42:28 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 21:42:28 +0100 (BST) Subject: [Rxtx] Closing a port from an event listener results in a deadlock In-Reply-To: <20050405175537.GA21747@rcog.homelinux.net> References: <20050405175537.GA21747@rcog.homelinux.net> Message-ID: On Tue, 5 Apr 2005 no_spam at somewhere.com wrote: > On the message I sent on March 14, does anyone had the chance to try the > modification? > > Or was it already fixed? (I haven't searched the archive extensively) > > Or maybe my message got catched by some spam filters? (it made it to the list > archive though) > > Anyway, I would appreciate some feedback (through the list) > The patch is here http://marc.theaimsgroup.com/?l=rxtx&m=111084488820288&w=2 I have applied this patch to a local copy but will not be doing formal testing for a couple weeks. I do not try to close ports from inside the eventListenter usually so I encourage any feedback also. If there are no problems reported, I expect this will go into rxtx 2.1-7. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Wed Apr 6 08:33:42 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Wed, 06 Apr 2005 15:33:42 +0100 Subject: [Rxtx] getting RXTX version Message-ID: <4253F346.50102@emation.pt> Hi, I want to make sure my deployments have the same version of RXTX jar and native lib. I know the version of the jar can be obtained in the Version class, but how can I obtain the native version ? I know RXTX prints to the console a warning if the version is different. Is there a way to programatically know is this is the case ? I would like to log that to our app's log thanks Ricardo From taj at www.linux.org.uk Wed Apr 6 15:10:20 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 6 Apr 2005 22:10:20 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4253F346.50102@emation.pt> References: <4253F346.50102@emation.pt> Message-ID: On Wed, 6 Apr 2005, Ricardo Trindade wrote: > Hi, > > I want to make sure my deployments have the same version of RXTX jar > and native lib. > > I know the version of the jar can be obtained in the Version class, > but how can I obtain the native version ? > > I know RXTX prints to the console a warning if the version is > different. Is there a way to programatically know is this is the case ? > > I would like to log that to our app's log > There isn't a suggested way of doing that right now. We could move things around and have a static String RXTXVersion.getNativeVersion() in future releases. Is this what you expected? This is not documented in commapi at all. I just tossed that in to catch conflicts while developing. It would be nice to have access in GUI applications though. It may be possible to access RXTXCommDriver.LibVersion right now. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Thu Apr 7 02:51:00 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 09:51:00 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> Message-ID: <4254F474.7020905@emation.pt> >There isn't a suggested way of doing that right now. We could move things >around and have a static String RXTXVersion.getNativeVersion() in future >releases. Is this what you expected? > > Yes, that would be perfect. >This is not documented in commapi at all. I just tossed that in to catch >conflicts while developing. It would be nice to have access in GUI >applications though. > >It may be possible to access RXTXCommDriver.LibVersion right now. > > > I tried, and I don't think it's possible. From taj at www.linux.org.uk Thu Apr 7 03:32:04 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 7 Apr 2005 10:32:04 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4254F474.7020905@emation.pt> References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: On Thu, 7 Apr 2005, Ricardo Trindade wrote: > > >There isn't a suggested way of doing that right now. We could move things > >around and have a static String RXTXVersion.getNativeVersion() in future > >releases. Is this what you expected? > > > > > > Yes, that would be perfect. > The attached should do what you want. You will still need to catch an exception for older versions... -- Trent Jarvi taj at www.linux.org.uk -------------- next part -------------- ? public_version.patch Index: RXTXCommDriver.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXCommDriver.java,v retrieving revision 1.16.2.51 diff -u -r1.16.2.51 RXTXCommDriver.java --- RXTXCommDriver.java 12 Oct 2004 09:13:30 -0000 1.16.2.51 +++ RXTXCommDriver.java 7 Apr 2005 09:29:04 -0000 @@ -54,7 +54,7 @@ the Library. */ String JarVersion = RXTXVersion.getVersion(); - String LibVersion = nativeGetVersion(); + String LibVersion = RXTXVersion.nativeGetVersion(); if ( devel ) { System.out.println("Devel Library"); @@ -76,7 +76,6 @@ /** Get the Serial port prefixes for the running OS */ private String deviceDirectory; private String osName; - private static native String nativeGetVersion(); private native boolean registerKnownPorts(int PortType); private native boolean isPortPrefixValid(String dev); private native boolean testRead(String dev, int type); Index: RXTXVersion.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXVersion.java,v retrieving revision 1.2.2.31 diff -u -r1.2.2.31 RXTXVersion.java --- RXTXVersion.java 16 Oct 2004 16:20:35 -0000 1.2.2.31 +++ RXTXVersion.java 7 Apr 2005 09:29:04 -0000 @@ -36,6 +36,7 @@ private static String Version; static { + System.loadLibrary( "rxtxSerial" ); Version = "RXTX-2.1-7pre20"; } /** @@ -47,4 +48,5 @@ { return(Version); } + public static native String nativeGetVersion(); } Index: SerialImp.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v retrieving revision 1.46.2.181 diff -u -r1.46.2.181 SerialImp.c --- SerialImp.c 17 Oct 2004 09:48:56 -0000 1.46.2.181 +++ SerialImp.c 7 Apr 2005 09:29:07 -0000 @@ -116,6 +116,7 @@ * It will eventually be removed. * */ #define RXTXPort(foo) Java_gnu_io_RXTXPort_ ## foo +#define RXTXVersion(foo) Java_gnu_io_RXTXVersion_ ## foo #define RXTXCommDriver(foo) Java_gnu_io_RXTXCommDriver_ ## foo #if defined(__sun__) || defined(__hpux__) @@ -4001,7 +4002,7 @@ } /*---------------------------------------------------------- -RXTXCommDriver.nativeGetVersion +RXTXVersion.nativeGetVersion accept: none perform: return the current version @@ -4010,9 +4011,10 @@ comments: This is used to avoid mixing versions of the .jar and native library. First introduced in rxtx-1.5-9 + Moved from RXTXCommDriver to RXTXVersion in rxtx-2.1-7 ----------------------------------------------------------*/ -JNIEXPORT jstring JNICALL RXTXCommDriver(nativeGetVersion) (JNIEnv *env, +JNIEXPORT jstring JNICALL RXTXVersion(nativeGetVersion) (JNIEnv *env, jclass jclazz ) { return (*env)->NewStringUTF( env, "RXTX-2.1-7pre20" ); From ricardo.trindade at emation.pt Thu Apr 7 03:45:58 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 10:45:58 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: <42550156.2040908@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050407/05212451/attachment-0102.html From thomas.shulok at lmco.com Thu Apr 7 17:43:11 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Thu, 07 Apr 2005 19:43:11 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi There, I'm attempting to talk RS232 between an embedded Linux box and a Windows box. Everything connects up fine, and I can send and receive a simple sequence of bytes with no problems. However, if around 5 seconds goes by without me sending something, I get the following when I attempt to send. java.io.IOException: Input/output error in writeArray Stack trace: java/lang/Throwable.()V java/lang/Throwable.(Ljava/lang/String;)V java/io/IOException.(Ljava/lang/String;)V gnu/io/RXTXPort.writeArray([BIIZ)V gnu/io/RXTXPort$SerialOutputStream.write([B)V SerialTest.main([Ljava/lang/String;)V If there interval is shorter (say 2 seconds between sends), I have no problems. On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and librxtxSerial-2.0.7pre2.so. Any ideas? Thanks, Thom -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5b23dcf/attachment-0102.html From taj at www.linux.org.uk Thu Apr 7 19:22:36 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:22:36 +0100 (BST) Subject: [Rxtx] Input/output error in writeArray In-Reply-To: References: Message-ID: On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a Windows > box. Everything connects up fine, and I can send and receive a simple > sequence of bytes with no problems. However, if around 5 seconds goes > by without me sending something, I get the following when I attempt to > send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Apr 7 19:24:59 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:24:59 +0100 (BST) Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) Message-ID: hmm. This would not work from applets would it? -- Trent Jarvi taj at www.linux.org.uk ---------- Forwarded message ---------- Date: Thu, 07 Apr 2005 16:05:53 -0400 From: Chris Gaffney To: taj at www.linux.org.uk Subject: RXTX Libraries on Classpath fix Hi, I submitted a patch for RXTX a few weeks ago to allow for loading the native libraries from the classpath. Since sending it to you I found it wasn't working on windows. I've fixed the problem and created a new patch that should replace the older one. The actual change is a one line from a String.equals() to a String.startsWith(). Thanks for a great piece of software, -Chris Gaffney Grand Valley State University -------------- next part -------------- A non-text attachment was scrubbed... Name: libraries_on_classpath_fixed.patch Type: text/x-patch Size: 5617 bytes Desc: Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5d423b8/libraries_on_classpath_fixed-0102.bin From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From thomas.shulok at lmco.com Fri Apr 8 10:38:55 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Fri, 08 Apr 2005 12:38:55 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi Trent, Thanks for the prompt response. Before diving deeper, I was wondering if there is a timeout parameter somewhere in the stack that I have not set properly. Given the nature of the failure (only fails if the line has been idle for a few seconds), it feels like some kind of timeout issue... Thanks again, Thom -----Original Message----- From: rxtx-bounces at mail.linuxgrrls.org [mailto:rxtx-bounces at mail.linuxgrrls.org] On Behalf Of Trent Jarvi Sent: Thursday, April 07, 2005 6:23 PM To: Java RXTX discussion Subject: Re: [Rxtx] Input/output error in writeArray On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a > Windows box. Everything connects up fine, and I can send and receive > a simple sequence of bytes with no problems. However, if around 5 > seconds goes by without me sending something, I get the following when > I attempt to send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at mail.linuxgrrls.org http://mail.linuxgrrls.org/mailman/listinfo/rxtx From ricardo.trindade at emation.pt Mon Apr 4 09:17:23 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Mon, 04 Apr 2005 16:17:23 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot Message-ID: <42515A83.4050907@emation.pt> Hi, I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most recent stable snapshot), and get the following exception : It looks like rxtx has been compiled with jdk 1.5. If this was indeed the case, I think there is a compilation flag that generates code that runs on older jdks. java.lang.UnsupportedClassVersionError: gnu/io/UnsupportedCommOperationException (Unsupported major.minor version 49.0) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at java.net.URLClassLoader.defineClass(URLClassLoader.java:251) at java.net.URLClassLoader.access$100(URLClassLoader.java:55) at java.net.URLClassLoader$1.run(URLClassLoader.java:194) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:187) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:141) I'm trying to run it with 1.4. thanks Ricardo From taj at www.linux.org.uk Tue Apr 5 00:48:12 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 07:48:12 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42515A83.4050907@emation.pt> References: <42515A83.4050907@emation.pt> Message-ID: On Mon, 4 Apr 2005, Ricardo Trindade wrote: > Hi, > > I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most > recent stable snapshot), and get the following exception : > > It looks like rxtx has been compiled with jdk 1.5. If this was > indeed the case, I think there is a compilation flag that generates code > that runs on older jdks. > > java.lang.UnsupportedClassVersionError: > gnu/io/UnsupportedCommOperationException (Unsupported major.minor > version 49.0) [snip] Thanks Ricardo I recompiled the jar with javac -source 1.3 -target 1.3. That should cover most of the JRE's in use today. I also compiled the rxtx 2.0 x86_64 native library which appeared to be missing. I tried looking for flags to pass gcc 4.0 to make the native libraries more backwards compatible but only found options for C++ which is not used in rxtx. I've got a list of other bugs that I'll be going through in the next few weeks but for now I just left them with the same CVS filename - no code changes. ftp://ftp.qbang.org/pub/rxtx/rxtx-2.0-CVS-20050120-bins.tar.gz ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-CVS-20050120-bins.tar.gz -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Tue Apr 5 02:24:33 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 05 Apr 2005 09:24:33 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: References: <42515A83.4050907@emation.pt> Message-ID: <42524B41.3040300@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050405/5919abbb/attachment-0103.html From taj at www.linux.org.uk Tue Apr 5 03:00:29 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 10:00:29 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42524B41.3040300@emation.pt> References: <42515A83.4050907@emation.pt> <42524B41.3040300@emation.pt> Message-ID: On Tue, 5 Apr 2005, Ricardo Trindade wrote: > Will you anounce to the list when a new release is available ? > There will be several incremental releases announced here. Once those are done, we will release 2.1.7 and 2.0.7. -- Trent Jarvi taj at www.linux.org.uk From no_spam at somewhere.com Tue Apr 5 11:55:37 2005 From: no_spam at somewhere.com (no_spam@somewhere.com) Date: Tue, 5 Apr 2005 13:55:37 -0400 Subject: [Rxtx] Closing a port from an event listener results in a deadlock Message-ID: <20050405175537.GA21747@rcog.homelinux.net> On the message I sent on March 14, does anyone had the chance to try the modification? Or was it already fixed? (I haven't searched the archive extensively) Or maybe my message got catched by some spam filters? (it made it to the list archive though) Anyway, I would appreciate some feedback (through the list) Thanks From taj at www.linux.org.uk Tue Apr 5 14:42:28 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 21:42:28 +0100 (BST) Subject: [Rxtx] Closing a port from an event listener results in a deadlock In-Reply-To: <20050405175537.GA21747@rcog.homelinux.net> References: <20050405175537.GA21747@rcog.homelinux.net> Message-ID: On Tue, 5 Apr 2005 no_spam at somewhere.com wrote: > On the message I sent on March 14, does anyone had the chance to try the > modification? > > Or was it already fixed? (I haven't searched the archive extensively) > > Or maybe my message got catched by some spam filters? (it made it to the list > archive though) > > Anyway, I would appreciate some feedback (through the list) > The patch is here http://marc.theaimsgroup.com/?l=rxtx&m=111084488820288&w=2 I have applied this patch to a local copy but will not be doing formal testing for a couple weeks. I do not try to close ports from inside the eventListenter usually so I encourage any feedback also. If there are no problems reported, I expect this will go into rxtx 2.1-7. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Wed Apr 6 08:33:42 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Wed, 06 Apr 2005 15:33:42 +0100 Subject: [Rxtx] getting RXTX version Message-ID: <4253F346.50102@emation.pt> Hi, I want to make sure my deployments have the same version of RXTX jar and native lib. I know the version of the jar can be obtained in the Version class, but how can I obtain the native version ? I know RXTX prints to the console a warning if the version is different. Is there a way to programatically know is this is the case ? I would like to log that to our app's log thanks Ricardo From taj at www.linux.org.uk Wed Apr 6 15:10:20 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 6 Apr 2005 22:10:20 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4253F346.50102@emation.pt> References: <4253F346.50102@emation.pt> Message-ID: On Wed, 6 Apr 2005, Ricardo Trindade wrote: > Hi, > > I want to make sure my deployments have the same version of RXTX jar > and native lib. > > I know the version of the jar can be obtained in the Version class, > but how can I obtain the native version ? > > I know RXTX prints to the console a warning if the version is > different. Is there a way to programatically know is this is the case ? > > I would like to log that to our app's log > There isn't a suggested way of doing that right now. We could move things around and have a static String RXTXVersion.getNativeVersion() in future releases. Is this what you expected? This is not documented in commapi at all. I just tossed that in to catch conflicts while developing. It would be nice to have access in GUI applications though. It may be possible to access RXTXCommDriver.LibVersion right now. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Thu Apr 7 02:51:00 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 09:51:00 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> Message-ID: <4254F474.7020905@emation.pt> >There isn't a suggested way of doing that right now. We could move things >around and have a static String RXTXVersion.getNativeVersion() in future >releases. Is this what you expected? > > Yes, that would be perfect. >This is not documented in commapi at all. I just tossed that in to catch >conflicts while developing. It would be nice to have access in GUI >applications though. > >It may be possible to access RXTXCommDriver.LibVersion right now. > > > I tried, and I don't think it's possible. From taj at www.linux.org.uk Thu Apr 7 03:32:04 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 7 Apr 2005 10:32:04 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4254F474.7020905@emation.pt> References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: On Thu, 7 Apr 2005, Ricardo Trindade wrote: > > >There isn't a suggested way of doing that right now. We could move things > >around and have a static String RXTXVersion.getNativeVersion() in future > >releases. Is this what you expected? > > > > > > Yes, that would be perfect. > The attached should do what you want. You will still need to catch an exception for older versions... -- Trent Jarvi taj at www.linux.org.uk -------------- next part -------------- ? public_version.patch Index: RXTXCommDriver.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXCommDriver.java,v retrieving revision 1.16.2.51 diff -u -r1.16.2.51 RXTXCommDriver.java --- RXTXCommDriver.java 12 Oct 2004 09:13:30 -0000 1.16.2.51 +++ RXTXCommDriver.java 7 Apr 2005 09:29:04 -0000 @@ -54,7 +54,7 @@ the Library. */ String JarVersion = RXTXVersion.getVersion(); - String LibVersion = nativeGetVersion(); + String LibVersion = RXTXVersion.nativeGetVersion(); if ( devel ) { System.out.println("Devel Library"); @@ -76,7 +76,6 @@ /** Get the Serial port prefixes for the running OS */ private String deviceDirectory; private String osName; - private static native String nativeGetVersion(); private native boolean registerKnownPorts(int PortType); private native boolean isPortPrefixValid(String dev); private native boolean testRead(String dev, int type); Index: RXTXVersion.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXVersion.java,v retrieving revision 1.2.2.31 diff -u -r1.2.2.31 RXTXVersion.java --- RXTXVersion.java 16 Oct 2004 16:20:35 -0000 1.2.2.31 +++ RXTXVersion.java 7 Apr 2005 09:29:04 -0000 @@ -36,6 +36,7 @@ private static String Version; static { + System.loadLibrary( "rxtxSerial" ); Version = "RXTX-2.1-7pre20"; } /** @@ -47,4 +48,5 @@ { return(Version); } + public static native String nativeGetVersion(); } Index: SerialImp.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v retrieving revision 1.46.2.181 diff -u -r1.46.2.181 SerialImp.c --- SerialImp.c 17 Oct 2004 09:48:56 -0000 1.46.2.181 +++ SerialImp.c 7 Apr 2005 09:29:07 -0000 @@ -116,6 +116,7 @@ * It will eventually be removed. * */ #define RXTXPort(foo) Java_gnu_io_RXTXPort_ ## foo +#define RXTXVersion(foo) Java_gnu_io_RXTXVersion_ ## foo #define RXTXCommDriver(foo) Java_gnu_io_RXTXCommDriver_ ## foo #if defined(__sun__) || defined(__hpux__) @@ -4001,7 +4002,7 @@ } /*---------------------------------------------------------- -RXTXCommDriver.nativeGetVersion +RXTXVersion.nativeGetVersion accept: none perform: return the current version @@ -4010,9 +4011,10 @@ comments: This is used to avoid mixing versions of the .jar and native library. First introduced in rxtx-1.5-9 + Moved from RXTXCommDriver to RXTXVersion in rxtx-2.1-7 ----------------------------------------------------------*/ -JNIEXPORT jstring JNICALL RXTXCommDriver(nativeGetVersion) (JNIEnv *env, +JNIEXPORT jstring JNICALL RXTXVersion(nativeGetVersion) (JNIEnv *env, jclass jclazz ) { return (*env)->NewStringUTF( env, "RXTX-2.1-7pre20" ); From ricardo.trindade at emation.pt Thu Apr 7 03:45:58 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 10:45:58 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: <42550156.2040908@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050407/05212451/attachment-0103.html From thomas.shulok at lmco.com Thu Apr 7 17:43:11 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Thu, 07 Apr 2005 19:43:11 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi There, I'm attempting to talk RS232 between an embedded Linux box and a Windows box. Everything connects up fine, and I can send and receive a simple sequence of bytes with no problems. However, if around 5 seconds goes by without me sending something, I get the following when I attempt to send. java.io.IOException: Input/output error in writeArray Stack trace: java/lang/Throwable.()V java/lang/Throwable.(Ljava/lang/String;)V java/io/IOException.(Ljava/lang/String;)V gnu/io/RXTXPort.writeArray([BIIZ)V gnu/io/RXTXPort$SerialOutputStream.write([B)V SerialTest.main([Ljava/lang/String;)V If there interval is shorter (say 2 seconds between sends), I have no problems. On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and librxtxSerial-2.0.7pre2.so. Any ideas? Thanks, Thom -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5b23dcf/attachment-0103.html From taj at www.linux.org.uk Thu Apr 7 19:22:36 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:22:36 +0100 (BST) Subject: [Rxtx] Input/output error in writeArray In-Reply-To: References: Message-ID: On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a Windows > box. Everything connects up fine, and I can send and receive a simple > sequence of bytes with no problems. However, if around 5 seconds goes > by without me sending something, I get the following when I attempt to > send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Apr 7 19:24:59 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:24:59 +0100 (BST) Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) Message-ID: hmm. This would not work from applets would it? -- Trent Jarvi taj at www.linux.org.uk ---------- Forwarded message ---------- Date: Thu, 07 Apr 2005 16:05:53 -0400 From: Chris Gaffney To: taj at www.linux.org.uk Subject: RXTX Libraries on Classpath fix Hi, I submitted a patch for RXTX a few weeks ago to allow for loading the native libraries from the classpath. Since sending it to you I found it wasn't working on windows. I've fixed the problem and created a new patch that should replace the older one. The actual change is a one line from a String.equals() to a String.startsWith(). Thanks for a great piece of software, -Chris Gaffney Grand Valley State University -------------- next part -------------- A non-text attachment was scrubbed... Name: libraries_on_classpath_fixed.patch Type: text/x-patch Size: 5617 bytes Desc: Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5d423b8/libraries_on_classpath_fixed-0103.bin From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From thomas.shulok at lmco.com Fri Apr 8 10:38:55 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Fri, 08 Apr 2005 12:38:55 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi Trent, Thanks for the prompt response. Before diving deeper, I was wondering if there is a timeout parameter somewhere in the stack that I have not set properly. Given the nature of the failure (only fails if the line has been idle for a few seconds), it feels like some kind of timeout issue... Thanks again, Thom -----Original Message----- From: rxtx-bounces at mail.linuxgrrls.org [mailto:rxtx-bounces at mail.linuxgrrls.org] On Behalf Of Trent Jarvi Sent: Thursday, April 07, 2005 6:23 PM To: Java RXTX discussion Subject: Re: [Rxtx] Input/output error in writeArray On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a > Windows box. Everything connects up fine, and I can send and receive > a simple sequence of bytes with no problems. However, if around 5 > seconds goes by without me sending something, I get the following when > I attempt to send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at mail.linuxgrrls.org http://mail.linuxgrrls.org/mailman/listinfo/rxtx From ricardo.trindade at emation.pt Mon Apr 4 09:17:23 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Mon, 04 Apr 2005 16:17:23 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot Message-ID: <42515A83.4050907@emation.pt> Hi, I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most recent stable snapshot), and get the following exception : It looks like rxtx has been compiled with jdk 1.5. If this was indeed the case, I think there is a compilation flag that generates code that runs on older jdks. java.lang.UnsupportedClassVersionError: gnu/io/UnsupportedCommOperationException (Unsupported major.minor version 49.0) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at java.net.URLClassLoader.defineClass(URLClassLoader.java:251) at java.net.URLClassLoader.access$100(URLClassLoader.java:55) at java.net.URLClassLoader$1.run(URLClassLoader.java:194) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:187) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:141) I'm trying to run it with 1.4. thanks Ricardo From taj at www.linux.org.uk Tue Apr 5 00:48:12 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 07:48:12 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42515A83.4050907@emation.pt> References: <42515A83.4050907@emation.pt> Message-ID: On Mon, 4 Apr 2005, Ricardo Trindade wrote: > Hi, > > I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most > recent stable snapshot), and get the following exception : > > It looks like rxtx has been compiled with jdk 1.5. If this was > indeed the case, I think there is a compilation flag that generates code > that runs on older jdks. > > java.lang.UnsupportedClassVersionError: > gnu/io/UnsupportedCommOperationException (Unsupported major.minor > version 49.0) [snip] Thanks Ricardo I recompiled the jar with javac -source 1.3 -target 1.3. That should cover most of the JRE's in use today. I also compiled the rxtx 2.0 x86_64 native library which appeared to be missing. I tried looking for flags to pass gcc 4.0 to make the native libraries more backwards compatible but only found options for C++ which is not used in rxtx. I've got a list of other bugs that I'll be going through in the next few weeks but for now I just left them with the same CVS filename - no code changes. ftp://ftp.qbang.org/pub/rxtx/rxtx-2.0-CVS-20050120-bins.tar.gz ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-CVS-20050120-bins.tar.gz -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Tue Apr 5 02:24:33 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 05 Apr 2005 09:24:33 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: References: <42515A83.4050907@emation.pt> Message-ID: <42524B41.3040300@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050405/5919abbb/attachment-0104.html From taj at www.linux.org.uk Tue Apr 5 03:00:29 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 10:00:29 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42524B41.3040300@emation.pt> References: <42515A83.4050907@emation.pt> <42524B41.3040300@emation.pt> Message-ID: On Tue, 5 Apr 2005, Ricardo Trindade wrote: > Will you anounce to the list when a new release is available ? > There will be several incremental releases announced here. Once those are done, we will release 2.1.7 and 2.0.7. -- Trent Jarvi taj at www.linux.org.uk From no_spam at somewhere.com Tue Apr 5 11:55:37 2005 From: no_spam at somewhere.com (no_spam@somewhere.com) Date: Tue, 5 Apr 2005 13:55:37 -0400 Subject: [Rxtx] Closing a port from an event listener results in a deadlock Message-ID: <20050405175537.GA21747@rcog.homelinux.net> On the message I sent on March 14, does anyone had the chance to try the modification? Or was it already fixed? (I haven't searched the archive extensively) Or maybe my message got catched by some spam filters? (it made it to the list archive though) Anyway, I would appreciate some feedback (through the list) Thanks From taj at www.linux.org.uk Tue Apr 5 14:42:28 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 21:42:28 +0100 (BST) Subject: [Rxtx] Closing a port from an event listener results in a deadlock In-Reply-To: <20050405175537.GA21747@rcog.homelinux.net> References: <20050405175537.GA21747@rcog.homelinux.net> Message-ID: On Tue, 5 Apr 2005 no_spam at somewhere.com wrote: > On the message I sent on March 14, does anyone had the chance to try the > modification? > > Or was it already fixed? (I haven't searched the archive extensively) > > Or maybe my message got catched by some spam filters? (it made it to the list > archive though) > > Anyway, I would appreciate some feedback (through the list) > The patch is here http://marc.theaimsgroup.com/?l=rxtx&m=111084488820288&w=2 I have applied this patch to a local copy but will not be doing formal testing for a couple weeks. I do not try to close ports from inside the eventListenter usually so I encourage any feedback also. If there are no problems reported, I expect this will go into rxtx 2.1-7. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Wed Apr 6 08:33:42 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Wed, 06 Apr 2005 15:33:42 +0100 Subject: [Rxtx] getting RXTX version Message-ID: <4253F346.50102@emation.pt> Hi, I want to make sure my deployments have the same version of RXTX jar and native lib. I know the version of the jar can be obtained in the Version class, but how can I obtain the native version ? I know RXTX prints to the console a warning if the version is different. Is there a way to programatically know is this is the case ? I would like to log that to our app's log thanks Ricardo From taj at www.linux.org.uk Wed Apr 6 15:10:20 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 6 Apr 2005 22:10:20 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4253F346.50102@emation.pt> References: <4253F346.50102@emation.pt> Message-ID: On Wed, 6 Apr 2005, Ricardo Trindade wrote: > Hi, > > I want to make sure my deployments have the same version of RXTX jar > and native lib. > > I know the version of the jar can be obtained in the Version class, > but how can I obtain the native version ? > > I know RXTX prints to the console a warning if the version is > different. Is there a way to programatically know is this is the case ? > > I would like to log that to our app's log > There isn't a suggested way of doing that right now. We could move things around and have a static String RXTXVersion.getNativeVersion() in future releases. Is this what you expected? This is not documented in commapi at all. I just tossed that in to catch conflicts while developing. It would be nice to have access in GUI applications though. It may be possible to access RXTXCommDriver.LibVersion right now. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Thu Apr 7 02:51:00 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 09:51:00 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> Message-ID: <4254F474.7020905@emation.pt> >There isn't a suggested way of doing that right now. We could move things >around and have a static String RXTXVersion.getNativeVersion() in future >releases. Is this what you expected? > > Yes, that would be perfect. >This is not documented in commapi at all. I just tossed that in to catch >conflicts while developing. It would be nice to have access in GUI >applications though. > >It may be possible to access RXTXCommDriver.LibVersion right now. > > > I tried, and I don't think it's possible. From taj at www.linux.org.uk Thu Apr 7 03:32:04 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 7 Apr 2005 10:32:04 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4254F474.7020905@emation.pt> References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: On Thu, 7 Apr 2005, Ricardo Trindade wrote: > > >There isn't a suggested way of doing that right now. We could move things > >around and have a static String RXTXVersion.getNativeVersion() in future > >releases. Is this what you expected? > > > > > > Yes, that would be perfect. > The attached should do what you want. You will still need to catch an exception for older versions... -- Trent Jarvi taj at www.linux.org.uk -------------- next part -------------- ? public_version.patch Index: RXTXCommDriver.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXCommDriver.java,v retrieving revision 1.16.2.51 diff -u -r1.16.2.51 RXTXCommDriver.java --- RXTXCommDriver.java 12 Oct 2004 09:13:30 -0000 1.16.2.51 +++ RXTXCommDriver.java 7 Apr 2005 09:29:04 -0000 @@ -54,7 +54,7 @@ the Library. */ String JarVersion = RXTXVersion.getVersion(); - String LibVersion = nativeGetVersion(); + String LibVersion = RXTXVersion.nativeGetVersion(); if ( devel ) { System.out.println("Devel Library"); @@ -76,7 +76,6 @@ /** Get the Serial port prefixes for the running OS */ private String deviceDirectory; private String osName; - private static native String nativeGetVersion(); private native boolean registerKnownPorts(int PortType); private native boolean isPortPrefixValid(String dev); private native boolean testRead(String dev, int type); Index: RXTXVersion.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXVersion.java,v retrieving revision 1.2.2.31 diff -u -r1.2.2.31 RXTXVersion.java --- RXTXVersion.java 16 Oct 2004 16:20:35 -0000 1.2.2.31 +++ RXTXVersion.java 7 Apr 2005 09:29:04 -0000 @@ -36,6 +36,7 @@ private static String Version; static { + System.loadLibrary( "rxtxSerial" ); Version = "RXTX-2.1-7pre20"; } /** @@ -47,4 +48,5 @@ { return(Version); } + public static native String nativeGetVersion(); } Index: SerialImp.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v retrieving revision 1.46.2.181 diff -u -r1.46.2.181 SerialImp.c --- SerialImp.c 17 Oct 2004 09:48:56 -0000 1.46.2.181 +++ SerialImp.c 7 Apr 2005 09:29:07 -0000 @@ -116,6 +116,7 @@ * It will eventually be removed. * */ #define RXTXPort(foo) Java_gnu_io_RXTXPort_ ## foo +#define RXTXVersion(foo) Java_gnu_io_RXTXVersion_ ## foo #define RXTXCommDriver(foo) Java_gnu_io_RXTXCommDriver_ ## foo #if defined(__sun__) || defined(__hpux__) @@ -4001,7 +4002,7 @@ } /*---------------------------------------------------------- -RXTXCommDriver.nativeGetVersion +RXTXVersion.nativeGetVersion accept: none perform: return the current version @@ -4010,9 +4011,10 @@ comments: This is used to avoid mixing versions of the .jar and native library. First introduced in rxtx-1.5-9 + Moved from RXTXCommDriver to RXTXVersion in rxtx-2.1-7 ----------------------------------------------------------*/ -JNIEXPORT jstring JNICALL RXTXCommDriver(nativeGetVersion) (JNIEnv *env, +JNIEXPORT jstring JNICALL RXTXVersion(nativeGetVersion) (JNIEnv *env, jclass jclazz ) { return (*env)->NewStringUTF( env, "RXTX-2.1-7pre20" ); From ricardo.trindade at emation.pt Thu Apr 7 03:45:58 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 10:45:58 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: <42550156.2040908@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050407/05212451/attachment-0104.html From thomas.shulok at lmco.com Thu Apr 7 17:43:11 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Thu, 07 Apr 2005 19:43:11 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi There, I'm attempting to talk RS232 between an embedded Linux box and a Windows box. Everything connects up fine, and I can send and receive a simple sequence of bytes with no problems. However, if around 5 seconds goes by without me sending something, I get the following when I attempt to send. java.io.IOException: Input/output error in writeArray Stack trace: java/lang/Throwable.()V java/lang/Throwable.(Ljava/lang/String;)V java/io/IOException.(Ljava/lang/String;)V gnu/io/RXTXPort.writeArray([BIIZ)V gnu/io/RXTXPort$SerialOutputStream.write([B)V SerialTest.main([Ljava/lang/String;)V If there interval is shorter (say 2 seconds between sends), I have no problems. On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and librxtxSerial-2.0.7pre2.so. Any ideas? Thanks, Thom -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5b23dcf/attachment-0104.html From taj at www.linux.org.uk Thu Apr 7 19:22:36 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:22:36 +0100 (BST) Subject: [Rxtx] Input/output error in writeArray In-Reply-To: References: Message-ID: On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a Windows > box. Everything connects up fine, and I can send and receive a simple > sequence of bytes with no problems. However, if around 5 seconds goes > by without me sending something, I get the following when I attempt to > send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Apr 7 19:24:59 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:24:59 +0100 (BST) Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) Message-ID: hmm. This would not work from applets would it? -- Trent Jarvi taj at www.linux.org.uk ---------- Forwarded message ---------- Date: Thu, 07 Apr 2005 16:05:53 -0400 From: Chris Gaffney To: taj at www.linux.org.uk Subject: RXTX Libraries on Classpath fix Hi, I submitted a patch for RXTX a few weeks ago to allow for loading the native libraries from the classpath. Since sending it to you I found it wasn't working on windows. I've fixed the problem and created a new patch that should replace the older one. The actual change is a one line from a String.equals() to a String.startsWith(). Thanks for a great piece of software, -Chris Gaffney Grand Valley State University -------------- next part -------------- A non-text attachment was scrubbed... Name: libraries_on_classpath_fixed.patch Type: text/x-patch Size: 5617 bytes Desc: Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5d423b8/libraries_on_classpath_fixed-0104.bin From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From thomas.shulok at lmco.com Fri Apr 8 10:38:55 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Fri, 08 Apr 2005 12:38:55 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi Trent, Thanks for the prompt response. Before diving deeper, I was wondering if there is a timeout parameter somewhere in the stack that I have not set properly. Given the nature of the failure (only fails if the line has been idle for a few seconds), it feels like some kind of timeout issue... Thanks again, Thom -----Original Message----- From: rxtx-bounces at mail.linuxgrrls.org [mailto:rxtx-bounces at mail.linuxgrrls.org] On Behalf Of Trent Jarvi Sent: Thursday, April 07, 2005 6:23 PM To: Java RXTX discussion Subject: Re: [Rxtx] Input/output error in writeArray On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a > Windows box. Everything connects up fine, and I can send and receive > a simple sequence of bytes with no problems. However, if around 5 > seconds goes by without me sending something, I get the following when > I attempt to send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at mail.linuxgrrls.org http://mail.linuxgrrls.org/mailman/listinfo/rxtx From ricardo.trindade at emation.pt Mon Apr 4 09:17:23 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Mon, 04 Apr 2005 16:17:23 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot Message-ID: <42515A83.4050907@emation.pt> Hi, I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most recent stable snapshot), and get the following exception : It looks like rxtx has been compiled with jdk 1.5. If this was indeed the case, I think there is a compilation flag that generates code that runs on older jdks. java.lang.UnsupportedClassVersionError: gnu/io/UnsupportedCommOperationException (Unsupported major.minor version 49.0) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at java.net.URLClassLoader.defineClass(URLClassLoader.java:251) at java.net.URLClassLoader.access$100(URLClassLoader.java:55) at java.net.URLClassLoader$1.run(URLClassLoader.java:194) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:187) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:141) I'm trying to run it with 1.4. thanks Ricardo From taj at www.linux.org.uk Tue Apr 5 00:48:12 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 07:48:12 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42515A83.4050907@emation.pt> References: <42515A83.4050907@emation.pt> Message-ID: On Mon, 4 Apr 2005, Ricardo Trindade wrote: > Hi, > > I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most > recent stable snapshot), and get the following exception : > > It looks like rxtx has been compiled with jdk 1.5. If this was > indeed the case, I think there is a compilation flag that generates code > that runs on older jdks. > > java.lang.UnsupportedClassVersionError: > gnu/io/UnsupportedCommOperationException (Unsupported major.minor > version 49.0) [snip] Thanks Ricardo I recompiled the jar with javac -source 1.3 -target 1.3. That should cover most of the JRE's in use today. I also compiled the rxtx 2.0 x86_64 native library which appeared to be missing. I tried looking for flags to pass gcc 4.0 to make the native libraries more backwards compatible but only found options for C++ which is not used in rxtx. I've got a list of other bugs that I'll be going through in the next few weeks but for now I just left them with the same CVS filename - no code changes. ftp://ftp.qbang.org/pub/rxtx/rxtx-2.0-CVS-20050120-bins.tar.gz ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-CVS-20050120-bins.tar.gz -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Tue Apr 5 02:24:33 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 05 Apr 2005 09:24:33 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: References: <42515A83.4050907@emation.pt> Message-ID: <42524B41.3040300@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050405/5919abbb/attachment-0105.html From taj at www.linux.org.uk Tue Apr 5 03:00:29 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 10:00:29 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42524B41.3040300@emation.pt> References: <42515A83.4050907@emation.pt> <42524B41.3040300@emation.pt> Message-ID: On Tue, 5 Apr 2005, Ricardo Trindade wrote: > Will you anounce to the list when a new release is available ? > There will be several incremental releases announced here. Once those are done, we will release 2.1.7 and 2.0.7. -- Trent Jarvi taj at www.linux.org.uk From no_spam at somewhere.com Tue Apr 5 11:55:37 2005 From: no_spam at somewhere.com (no_spam@somewhere.com) Date: Tue, 5 Apr 2005 13:55:37 -0400 Subject: [Rxtx] Closing a port from an event listener results in a deadlock Message-ID: <20050405175537.GA21747@rcog.homelinux.net> On the message I sent on March 14, does anyone had the chance to try the modification? Or was it already fixed? (I haven't searched the archive extensively) Or maybe my message got catched by some spam filters? (it made it to the list archive though) Anyway, I would appreciate some feedback (through the list) Thanks From taj at www.linux.org.uk Tue Apr 5 14:42:28 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 21:42:28 +0100 (BST) Subject: [Rxtx] Closing a port from an event listener results in a deadlock In-Reply-To: <20050405175537.GA21747@rcog.homelinux.net> References: <20050405175537.GA21747@rcog.homelinux.net> Message-ID: On Tue, 5 Apr 2005 no_spam at somewhere.com wrote: > On the message I sent on March 14, does anyone had the chance to try the > modification? > > Or was it already fixed? (I haven't searched the archive extensively) > > Or maybe my message got catched by some spam filters? (it made it to the list > archive though) > > Anyway, I would appreciate some feedback (through the list) > The patch is here http://marc.theaimsgroup.com/?l=rxtx&m=111084488820288&w=2 I have applied this patch to a local copy but will not be doing formal testing for a couple weeks. I do not try to close ports from inside the eventListenter usually so I encourage any feedback also. If there are no problems reported, I expect this will go into rxtx 2.1-7. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Wed Apr 6 08:33:42 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Wed, 06 Apr 2005 15:33:42 +0100 Subject: [Rxtx] getting RXTX version Message-ID: <4253F346.50102@emation.pt> Hi, I want to make sure my deployments have the same version of RXTX jar and native lib. I know the version of the jar can be obtained in the Version class, but how can I obtain the native version ? I know RXTX prints to the console a warning if the version is different. Is there a way to programatically know is this is the case ? I would like to log that to our app's log thanks Ricardo From taj at www.linux.org.uk Wed Apr 6 15:10:20 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 6 Apr 2005 22:10:20 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4253F346.50102@emation.pt> References: <4253F346.50102@emation.pt> Message-ID: On Wed, 6 Apr 2005, Ricardo Trindade wrote: > Hi, > > I want to make sure my deployments have the same version of RXTX jar > and native lib. > > I know the version of the jar can be obtained in the Version class, > but how can I obtain the native version ? > > I know RXTX prints to the console a warning if the version is > different. Is there a way to programatically know is this is the case ? > > I would like to log that to our app's log > There isn't a suggested way of doing that right now. We could move things around and have a static String RXTXVersion.getNativeVersion() in future releases. Is this what you expected? This is not documented in commapi at all. I just tossed that in to catch conflicts while developing. It would be nice to have access in GUI applications though. It may be possible to access RXTXCommDriver.LibVersion right now. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Thu Apr 7 02:51:00 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 09:51:00 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> Message-ID: <4254F474.7020905@emation.pt> >There isn't a suggested way of doing that right now. We could move things >around and have a static String RXTXVersion.getNativeVersion() in future >releases. Is this what you expected? > > Yes, that would be perfect. >This is not documented in commapi at all. I just tossed that in to catch >conflicts while developing. It would be nice to have access in GUI >applications though. > >It may be possible to access RXTXCommDriver.LibVersion right now. > > > I tried, and I don't think it's possible. From taj at www.linux.org.uk Thu Apr 7 03:32:04 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 7 Apr 2005 10:32:04 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4254F474.7020905@emation.pt> References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: On Thu, 7 Apr 2005, Ricardo Trindade wrote: > > >There isn't a suggested way of doing that right now. We could move things > >around and have a static String RXTXVersion.getNativeVersion() in future > >releases. Is this what you expected? > > > > > > Yes, that would be perfect. > The attached should do what you want. You will still need to catch an exception for older versions... -- Trent Jarvi taj at www.linux.org.uk -------------- next part -------------- ? public_version.patch Index: RXTXCommDriver.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXCommDriver.java,v retrieving revision 1.16.2.51 diff -u -r1.16.2.51 RXTXCommDriver.java --- RXTXCommDriver.java 12 Oct 2004 09:13:30 -0000 1.16.2.51 +++ RXTXCommDriver.java 7 Apr 2005 09:29:04 -0000 @@ -54,7 +54,7 @@ the Library. */ String JarVersion = RXTXVersion.getVersion(); - String LibVersion = nativeGetVersion(); + String LibVersion = RXTXVersion.nativeGetVersion(); if ( devel ) { System.out.println("Devel Library"); @@ -76,7 +76,6 @@ /** Get the Serial port prefixes for the running OS */ private String deviceDirectory; private String osName; - private static native String nativeGetVersion(); private native boolean registerKnownPorts(int PortType); private native boolean isPortPrefixValid(String dev); private native boolean testRead(String dev, int type); Index: RXTXVersion.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXVersion.java,v retrieving revision 1.2.2.31 diff -u -r1.2.2.31 RXTXVersion.java --- RXTXVersion.java 16 Oct 2004 16:20:35 -0000 1.2.2.31 +++ RXTXVersion.java 7 Apr 2005 09:29:04 -0000 @@ -36,6 +36,7 @@ private static String Version; static { + System.loadLibrary( "rxtxSerial" ); Version = "RXTX-2.1-7pre20"; } /** @@ -47,4 +48,5 @@ { return(Version); } + public static native String nativeGetVersion(); } Index: SerialImp.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v retrieving revision 1.46.2.181 diff -u -r1.46.2.181 SerialImp.c --- SerialImp.c 17 Oct 2004 09:48:56 -0000 1.46.2.181 +++ SerialImp.c 7 Apr 2005 09:29:07 -0000 @@ -116,6 +116,7 @@ * It will eventually be removed. * */ #define RXTXPort(foo) Java_gnu_io_RXTXPort_ ## foo +#define RXTXVersion(foo) Java_gnu_io_RXTXVersion_ ## foo #define RXTXCommDriver(foo) Java_gnu_io_RXTXCommDriver_ ## foo #if defined(__sun__) || defined(__hpux__) @@ -4001,7 +4002,7 @@ } /*---------------------------------------------------------- -RXTXCommDriver.nativeGetVersion +RXTXVersion.nativeGetVersion accept: none perform: return the current version @@ -4010,9 +4011,10 @@ comments: This is used to avoid mixing versions of the .jar and native library. First introduced in rxtx-1.5-9 + Moved from RXTXCommDriver to RXTXVersion in rxtx-2.1-7 ----------------------------------------------------------*/ -JNIEXPORT jstring JNICALL RXTXCommDriver(nativeGetVersion) (JNIEnv *env, +JNIEXPORT jstring JNICALL RXTXVersion(nativeGetVersion) (JNIEnv *env, jclass jclazz ) { return (*env)->NewStringUTF( env, "RXTX-2.1-7pre20" ); From ricardo.trindade at emation.pt Thu Apr 7 03:45:58 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 10:45:58 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: <42550156.2040908@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050407/05212451/attachment-0105.html From thomas.shulok at lmco.com Thu Apr 7 17:43:11 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Thu, 07 Apr 2005 19:43:11 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi There, I'm attempting to talk RS232 between an embedded Linux box and a Windows box. Everything connects up fine, and I can send and receive a simple sequence of bytes with no problems. However, if around 5 seconds goes by without me sending something, I get the following when I attempt to send. java.io.IOException: Input/output error in writeArray Stack trace: java/lang/Throwable.()V java/lang/Throwable.(Ljava/lang/String;)V java/io/IOException.(Ljava/lang/String;)V gnu/io/RXTXPort.writeArray([BIIZ)V gnu/io/RXTXPort$SerialOutputStream.write([B)V SerialTest.main([Ljava/lang/String;)V If there interval is shorter (say 2 seconds between sends), I have no problems. On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and librxtxSerial-2.0.7pre2.so. Any ideas? Thanks, Thom -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5b23dcf/attachment-0105.html From taj at www.linux.org.uk Thu Apr 7 19:22:36 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:22:36 +0100 (BST) Subject: [Rxtx] Input/output error in writeArray In-Reply-To: References: Message-ID: On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a Windows > box. Everything connects up fine, and I can send and receive a simple > sequence of bytes with no problems. However, if around 5 seconds goes > by without me sending something, I get the following when I attempt to > send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Apr 7 19:24:59 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:24:59 +0100 (BST) Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) Message-ID: hmm. This would not work from applets would it? -- Trent Jarvi taj at www.linux.org.uk ---------- Forwarded message ---------- Date: Thu, 07 Apr 2005 16:05:53 -0400 From: Chris Gaffney To: taj at www.linux.org.uk Subject: RXTX Libraries on Classpath fix Hi, I submitted a patch for RXTX a few weeks ago to allow for loading the native libraries from the classpath. Since sending it to you I found it wasn't working on windows. I've fixed the problem and created a new patch that should replace the older one. The actual change is a one line from a String.equals() to a String.startsWith(). Thanks for a great piece of software, -Chris Gaffney Grand Valley State University -------------- next part -------------- A non-text attachment was scrubbed... Name: libraries_on_classpath_fixed.patch Type: text/x-patch Size: 5617 bytes Desc: Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5d423b8/libraries_on_classpath_fixed-0105.bin From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From thomas.shulok at lmco.com Fri Apr 8 10:38:55 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Fri, 08 Apr 2005 12:38:55 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi Trent, Thanks for the prompt response. Before diving deeper, I was wondering if there is a timeout parameter somewhere in the stack that I have not set properly. Given the nature of the failure (only fails if the line has been idle for a few seconds), it feels like some kind of timeout issue... Thanks again, Thom -----Original Message----- From: rxtx-bounces at mail.linuxgrrls.org [mailto:rxtx-bounces at mail.linuxgrrls.org] On Behalf Of Trent Jarvi Sent: Thursday, April 07, 2005 6:23 PM To: Java RXTX discussion Subject: Re: [Rxtx] Input/output error in writeArray On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a > Windows box. Everything connects up fine, and I can send and receive > a simple sequence of bytes with no problems. However, if around 5 > seconds goes by without me sending something, I get the following when > I attempt to send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at mail.linuxgrrls.org http://mail.linuxgrrls.org/mailman/listinfo/rxtx From ricardo.trindade at emation.pt Mon Apr 4 09:17:23 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Mon, 04 Apr 2005 16:17:23 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot Message-ID: <42515A83.4050907@emation.pt> Hi, I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most recent stable snapshot), and get the following exception : It looks like rxtx has been compiled with jdk 1.5. If this was indeed the case, I think there is a compilation flag that generates code that runs on older jdks. java.lang.UnsupportedClassVersionError: gnu/io/UnsupportedCommOperationException (Unsupported major.minor version 49.0) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at java.net.URLClassLoader.defineClass(URLClassLoader.java:251) at java.net.URLClassLoader.access$100(URLClassLoader.java:55) at java.net.URLClassLoader$1.run(URLClassLoader.java:194) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:187) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:141) I'm trying to run it with 1.4. thanks Ricardo From taj at www.linux.org.uk Tue Apr 5 00:48:12 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 07:48:12 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42515A83.4050907@emation.pt> References: <42515A83.4050907@emation.pt> Message-ID: On Mon, 4 Apr 2005, Ricardo Trindade wrote: > Hi, > > I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most > recent stable snapshot), and get the following exception : > > It looks like rxtx has been compiled with jdk 1.5. If this was > indeed the case, I think there is a compilation flag that generates code > that runs on older jdks. > > java.lang.UnsupportedClassVersionError: > gnu/io/UnsupportedCommOperationException (Unsupported major.minor > version 49.0) [snip] Thanks Ricardo I recompiled the jar with javac -source 1.3 -target 1.3. That should cover most of the JRE's in use today. I also compiled the rxtx 2.0 x86_64 native library which appeared to be missing. I tried looking for flags to pass gcc 4.0 to make the native libraries more backwards compatible but only found options for C++ which is not used in rxtx. I've got a list of other bugs that I'll be going through in the next few weeks but for now I just left them with the same CVS filename - no code changes. ftp://ftp.qbang.org/pub/rxtx/rxtx-2.0-CVS-20050120-bins.tar.gz ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-CVS-20050120-bins.tar.gz -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Tue Apr 5 02:24:33 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 05 Apr 2005 09:24:33 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: References: <42515A83.4050907@emation.pt> Message-ID: <42524B41.3040300@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050405/5919abbb/attachment-0106.html From taj at www.linux.org.uk Tue Apr 5 03:00:29 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 10:00:29 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42524B41.3040300@emation.pt> References: <42515A83.4050907@emation.pt> <42524B41.3040300@emation.pt> Message-ID: On Tue, 5 Apr 2005, Ricardo Trindade wrote: > Will you anounce to the list when a new release is available ? > There will be several incremental releases announced here. Once those are done, we will release 2.1.7 and 2.0.7. -- Trent Jarvi taj at www.linux.org.uk From no_spam at somewhere.com Tue Apr 5 11:55:37 2005 From: no_spam at somewhere.com (no_spam@somewhere.com) Date: Tue, 5 Apr 2005 13:55:37 -0400 Subject: [Rxtx] Closing a port from an event listener results in a deadlock Message-ID: <20050405175537.GA21747@rcog.homelinux.net> On the message I sent on March 14, does anyone had the chance to try the modification? Or was it already fixed? (I haven't searched the archive extensively) Or maybe my message got catched by some spam filters? (it made it to the list archive though) Anyway, I would appreciate some feedback (through the list) Thanks From taj at www.linux.org.uk Tue Apr 5 14:42:28 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 21:42:28 +0100 (BST) Subject: [Rxtx] Closing a port from an event listener results in a deadlock In-Reply-To: <20050405175537.GA21747@rcog.homelinux.net> References: <20050405175537.GA21747@rcog.homelinux.net> Message-ID: On Tue, 5 Apr 2005 no_spam at somewhere.com wrote: > On the message I sent on March 14, does anyone had the chance to try the > modification? > > Or was it already fixed? (I haven't searched the archive extensively) > > Or maybe my message got catched by some spam filters? (it made it to the list > archive though) > > Anyway, I would appreciate some feedback (through the list) > The patch is here http://marc.theaimsgroup.com/?l=rxtx&m=111084488820288&w=2 I have applied this patch to a local copy but will not be doing formal testing for a couple weeks. I do not try to close ports from inside the eventListenter usually so I encourage any feedback also. If there are no problems reported, I expect this will go into rxtx 2.1-7. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Wed Apr 6 08:33:42 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Wed, 06 Apr 2005 15:33:42 +0100 Subject: [Rxtx] getting RXTX version Message-ID: <4253F346.50102@emation.pt> Hi, I want to make sure my deployments have the same version of RXTX jar and native lib. I know the version of the jar can be obtained in the Version class, but how can I obtain the native version ? I know RXTX prints to the console a warning if the version is different. Is there a way to programatically know is this is the case ? I would like to log that to our app's log thanks Ricardo From taj at www.linux.org.uk Wed Apr 6 15:10:20 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 6 Apr 2005 22:10:20 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4253F346.50102@emation.pt> References: <4253F346.50102@emation.pt> Message-ID: On Wed, 6 Apr 2005, Ricardo Trindade wrote: > Hi, > > I want to make sure my deployments have the same version of RXTX jar > and native lib. > > I know the version of the jar can be obtained in the Version class, > but how can I obtain the native version ? > > I know RXTX prints to the console a warning if the version is > different. Is there a way to programatically know is this is the case ? > > I would like to log that to our app's log > There isn't a suggested way of doing that right now. We could move things around and have a static String RXTXVersion.getNativeVersion() in future releases. Is this what you expected? This is not documented in commapi at all. I just tossed that in to catch conflicts while developing. It would be nice to have access in GUI applications though. It may be possible to access RXTXCommDriver.LibVersion right now. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Thu Apr 7 02:51:00 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 09:51:00 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> Message-ID: <4254F474.7020905@emation.pt> >There isn't a suggested way of doing that right now. We could move things >around and have a static String RXTXVersion.getNativeVersion() in future >releases. Is this what you expected? > > Yes, that would be perfect. >This is not documented in commapi at all. I just tossed that in to catch >conflicts while developing. It would be nice to have access in GUI >applications though. > >It may be possible to access RXTXCommDriver.LibVersion right now. > > > I tried, and I don't think it's possible. From taj at www.linux.org.uk Thu Apr 7 03:32:04 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 7 Apr 2005 10:32:04 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4254F474.7020905@emation.pt> References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: On Thu, 7 Apr 2005, Ricardo Trindade wrote: > > >There isn't a suggested way of doing that right now. We could move things > >around and have a static String RXTXVersion.getNativeVersion() in future > >releases. Is this what you expected? > > > > > > Yes, that would be perfect. > The attached should do what you want. You will still need to catch an exception for older versions... -- Trent Jarvi taj at www.linux.org.uk -------------- next part -------------- ? public_version.patch Index: RXTXCommDriver.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXCommDriver.java,v retrieving revision 1.16.2.51 diff -u -r1.16.2.51 RXTXCommDriver.java --- RXTXCommDriver.java 12 Oct 2004 09:13:30 -0000 1.16.2.51 +++ RXTXCommDriver.java 7 Apr 2005 09:29:04 -0000 @@ -54,7 +54,7 @@ the Library. */ String JarVersion = RXTXVersion.getVersion(); - String LibVersion = nativeGetVersion(); + String LibVersion = RXTXVersion.nativeGetVersion(); if ( devel ) { System.out.println("Devel Library"); @@ -76,7 +76,6 @@ /** Get the Serial port prefixes for the running OS */ private String deviceDirectory; private String osName; - private static native String nativeGetVersion(); private native boolean registerKnownPorts(int PortType); private native boolean isPortPrefixValid(String dev); private native boolean testRead(String dev, int type); Index: RXTXVersion.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXVersion.java,v retrieving revision 1.2.2.31 diff -u -r1.2.2.31 RXTXVersion.java --- RXTXVersion.java 16 Oct 2004 16:20:35 -0000 1.2.2.31 +++ RXTXVersion.java 7 Apr 2005 09:29:04 -0000 @@ -36,6 +36,7 @@ private static String Version; static { + System.loadLibrary( "rxtxSerial" ); Version = "RXTX-2.1-7pre20"; } /** @@ -47,4 +48,5 @@ { return(Version); } + public static native String nativeGetVersion(); } Index: SerialImp.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v retrieving revision 1.46.2.181 diff -u -r1.46.2.181 SerialImp.c --- SerialImp.c 17 Oct 2004 09:48:56 -0000 1.46.2.181 +++ SerialImp.c 7 Apr 2005 09:29:07 -0000 @@ -116,6 +116,7 @@ * It will eventually be removed. * */ #define RXTXPort(foo) Java_gnu_io_RXTXPort_ ## foo +#define RXTXVersion(foo) Java_gnu_io_RXTXVersion_ ## foo #define RXTXCommDriver(foo) Java_gnu_io_RXTXCommDriver_ ## foo #if defined(__sun__) || defined(__hpux__) @@ -4001,7 +4002,7 @@ } /*---------------------------------------------------------- -RXTXCommDriver.nativeGetVersion +RXTXVersion.nativeGetVersion accept: none perform: return the current version @@ -4010,9 +4011,10 @@ comments: This is used to avoid mixing versions of the .jar and native library. First introduced in rxtx-1.5-9 + Moved from RXTXCommDriver to RXTXVersion in rxtx-2.1-7 ----------------------------------------------------------*/ -JNIEXPORT jstring JNICALL RXTXCommDriver(nativeGetVersion) (JNIEnv *env, +JNIEXPORT jstring JNICALL RXTXVersion(nativeGetVersion) (JNIEnv *env, jclass jclazz ) { return (*env)->NewStringUTF( env, "RXTX-2.1-7pre20" ); From ricardo.trindade at emation.pt Thu Apr 7 03:45:58 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 10:45:58 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: <42550156.2040908@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050407/05212451/attachment-0106.html From thomas.shulok at lmco.com Thu Apr 7 17:43:11 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Thu, 07 Apr 2005 19:43:11 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi There, I'm attempting to talk RS232 between an embedded Linux box and a Windows box. Everything connects up fine, and I can send and receive a simple sequence of bytes with no problems. However, if around 5 seconds goes by without me sending something, I get the following when I attempt to send. java.io.IOException: Input/output error in writeArray Stack trace: java/lang/Throwable.()V java/lang/Throwable.(Ljava/lang/String;)V java/io/IOException.(Ljava/lang/String;)V gnu/io/RXTXPort.writeArray([BIIZ)V gnu/io/RXTXPort$SerialOutputStream.write([B)V SerialTest.main([Ljava/lang/String;)V If there interval is shorter (say 2 seconds between sends), I have no problems. On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and librxtxSerial-2.0.7pre2.so. Any ideas? Thanks, Thom -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5b23dcf/attachment-0106.html From taj at www.linux.org.uk Thu Apr 7 19:22:36 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:22:36 +0100 (BST) Subject: [Rxtx] Input/output error in writeArray In-Reply-To: References: Message-ID: On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a Windows > box. Everything connects up fine, and I can send and receive a simple > sequence of bytes with no problems. However, if around 5 seconds goes > by without me sending something, I get the following when I attempt to > send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Apr 7 19:24:59 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:24:59 +0100 (BST) Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) Message-ID: hmm. This would not work from applets would it? -- Trent Jarvi taj at www.linux.org.uk ---------- Forwarded message ---------- Date: Thu, 07 Apr 2005 16:05:53 -0400 From: Chris Gaffney To: taj at www.linux.org.uk Subject: RXTX Libraries on Classpath fix Hi, I submitted a patch for RXTX a few weeks ago to allow for loading the native libraries from the classpath. Since sending it to you I found it wasn't working on windows. I've fixed the problem and created a new patch that should replace the older one. The actual change is a one line from a String.equals() to a String.startsWith(). Thanks for a great piece of software, -Chris Gaffney Grand Valley State University -------------- next part -------------- A non-text attachment was scrubbed... Name: libraries_on_classpath_fixed.patch Type: text/x-patch Size: 5617 bytes Desc: Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5d423b8/libraries_on_classpath_fixed-0106.bin From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From thomas.shulok at lmco.com Fri Apr 8 10:38:55 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Fri, 08 Apr 2005 12:38:55 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi Trent, Thanks for the prompt response. Before diving deeper, I was wondering if there is a timeout parameter somewhere in the stack that I have not set properly. Given the nature of the failure (only fails if the line has been idle for a few seconds), it feels like some kind of timeout issue... Thanks again, Thom -----Original Message----- From: rxtx-bounces at mail.linuxgrrls.org [mailto:rxtx-bounces at mail.linuxgrrls.org] On Behalf Of Trent Jarvi Sent: Thursday, April 07, 2005 6:23 PM To: Java RXTX discussion Subject: Re: [Rxtx] Input/output error in writeArray On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a > Windows box. Everything connects up fine, and I can send and receive > a simple sequence of bytes with no problems. However, if around 5 > seconds goes by without me sending something, I get the following when > I attempt to send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at mail.linuxgrrls.org http://mail.linuxgrrls.org/mailman/listinfo/rxtx From ricardo.trindade at emation.pt Mon Apr 4 09:17:23 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Mon, 04 Apr 2005 16:17:23 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot Message-ID: <42515A83.4050907@emation.pt> Hi, I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most recent stable snapshot), and get the following exception : It looks like rxtx has been compiled with jdk 1.5. If this was indeed the case, I think there is a compilation flag that generates code that runs on older jdks. java.lang.UnsupportedClassVersionError: gnu/io/UnsupportedCommOperationException (Unsupported major.minor version 49.0) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at java.net.URLClassLoader.defineClass(URLClassLoader.java:251) at java.net.URLClassLoader.access$100(URLClassLoader.java:55) at java.net.URLClassLoader$1.run(URLClassLoader.java:194) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:187) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:141) I'm trying to run it with 1.4. thanks Ricardo From taj at www.linux.org.uk Tue Apr 5 00:48:12 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 07:48:12 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42515A83.4050907@emation.pt> References: <42515A83.4050907@emation.pt> Message-ID: On Mon, 4 Apr 2005, Ricardo Trindade wrote: > Hi, > > I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most > recent stable snapshot), and get the following exception : > > It looks like rxtx has been compiled with jdk 1.5. If this was > indeed the case, I think there is a compilation flag that generates code > that runs on older jdks. > > java.lang.UnsupportedClassVersionError: > gnu/io/UnsupportedCommOperationException (Unsupported major.minor > version 49.0) [snip] Thanks Ricardo I recompiled the jar with javac -source 1.3 -target 1.3. That should cover most of the JRE's in use today. I also compiled the rxtx 2.0 x86_64 native library which appeared to be missing. I tried looking for flags to pass gcc 4.0 to make the native libraries more backwards compatible but only found options for C++ which is not used in rxtx. I've got a list of other bugs that I'll be going through in the next few weeks but for now I just left them with the same CVS filename - no code changes. ftp://ftp.qbang.org/pub/rxtx/rxtx-2.0-CVS-20050120-bins.tar.gz ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-CVS-20050120-bins.tar.gz -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Tue Apr 5 02:24:33 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 05 Apr 2005 09:24:33 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: References: <42515A83.4050907@emation.pt> Message-ID: <42524B41.3040300@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050405/5919abbb/attachment-0107.html From taj at www.linux.org.uk Tue Apr 5 03:00:29 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 10:00:29 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42524B41.3040300@emation.pt> References: <42515A83.4050907@emation.pt> <42524B41.3040300@emation.pt> Message-ID: On Tue, 5 Apr 2005, Ricardo Trindade wrote: > Will you anounce to the list when a new release is available ? > There will be several incremental releases announced here. Once those are done, we will release 2.1.7 and 2.0.7. -- Trent Jarvi taj at www.linux.org.uk From no_spam at somewhere.com Tue Apr 5 11:55:37 2005 From: no_spam at somewhere.com (no_spam@somewhere.com) Date: Tue, 5 Apr 2005 13:55:37 -0400 Subject: [Rxtx] Closing a port from an event listener results in a deadlock Message-ID: <20050405175537.GA21747@rcog.homelinux.net> On the message I sent on March 14, does anyone had the chance to try the modification? Or was it already fixed? (I haven't searched the archive extensively) Or maybe my message got catched by some spam filters? (it made it to the list archive though) Anyway, I would appreciate some feedback (through the list) Thanks From taj at www.linux.org.uk Tue Apr 5 14:42:28 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 21:42:28 +0100 (BST) Subject: [Rxtx] Closing a port from an event listener results in a deadlock In-Reply-To: <20050405175537.GA21747@rcog.homelinux.net> References: <20050405175537.GA21747@rcog.homelinux.net> Message-ID: On Tue, 5 Apr 2005 no_spam at somewhere.com wrote: > On the message I sent on March 14, does anyone had the chance to try the > modification? > > Or was it already fixed? (I haven't searched the archive extensively) > > Or maybe my message got catched by some spam filters? (it made it to the list > archive though) > > Anyway, I would appreciate some feedback (through the list) > The patch is here http://marc.theaimsgroup.com/?l=rxtx&m=111084488820288&w=2 I have applied this patch to a local copy but will not be doing formal testing for a couple weeks. I do not try to close ports from inside the eventListenter usually so I encourage any feedback also. If there are no problems reported, I expect this will go into rxtx 2.1-7. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Wed Apr 6 08:33:42 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Wed, 06 Apr 2005 15:33:42 +0100 Subject: [Rxtx] getting RXTX version Message-ID: <4253F346.50102@emation.pt> Hi, I want to make sure my deployments have the same version of RXTX jar and native lib. I know the version of the jar can be obtained in the Version class, but how can I obtain the native version ? I know RXTX prints to the console a warning if the version is different. Is there a way to programatically know is this is the case ? I would like to log that to our app's log thanks Ricardo From taj at www.linux.org.uk Wed Apr 6 15:10:20 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 6 Apr 2005 22:10:20 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4253F346.50102@emation.pt> References: <4253F346.50102@emation.pt> Message-ID: On Wed, 6 Apr 2005, Ricardo Trindade wrote: > Hi, > > I want to make sure my deployments have the same version of RXTX jar > and native lib. > > I know the version of the jar can be obtained in the Version class, > but how can I obtain the native version ? > > I know RXTX prints to the console a warning if the version is > different. Is there a way to programatically know is this is the case ? > > I would like to log that to our app's log > There isn't a suggested way of doing that right now. We could move things around and have a static String RXTXVersion.getNativeVersion() in future releases. Is this what you expected? This is not documented in commapi at all. I just tossed that in to catch conflicts while developing. It would be nice to have access in GUI applications though. It may be possible to access RXTXCommDriver.LibVersion right now. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Thu Apr 7 02:51:00 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 09:51:00 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> Message-ID: <4254F474.7020905@emation.pt> >There isn't a suggested way of doing that right now. We could move things >around and have a static String RXTXVersion.getNativeVersion() in future >releases. Is this what you expected? > > Yes, that would be perfect. >This is not documented in commapi at all. I just tossed that in to catch >conflicts while developing. It would be nice to have access in GUI >applications though. > >It may be possible to access RXTXCommDriver.LibVersion right now. > > > I tried, and I don't think it's possible. From taj at www.linux.org.uk Thu Apr 7 03:32:04 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 7 Apr 2005 10:32:04 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4254F474.7020905@emation.pt> References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: On Thu, 7 Apr 2005, Ricardo Trindade wrote: > > >There isn't a suggested way of doing that right now. We could move things > >around and have a static String RXTXVersion.getNativeVersion() in future > >releases. Is this what you expected? > > > > > > Yes, that would be perfect. > The attached should do what you want. You will still need to catch an exception for older versions... -- Trent Jarvi taj at www.linux.org.uk -------------- next part -------------- ? public_version.patch Index: RXTXCommDriver.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXCommDriver.java,v retrieving revision 1.16.2.51 diff -u -r1.16.2.51 RXTXCommDriver.java --- RXTXCommDriver.java 12 Oct 2004 09:13:30 -0000 1.16.2.51 +++ RXTXCommDriver.java 7 Apr 2005 09:29:04 -0000 @@ -54,7 +54,7 @@ the Library. */ String JarVersion = RXTXVersion.getVersion(); - String LibVersion = nativeGetVersion(); + String LibVersion = RXTXVersion.nativeGetVersion(); if ( devel ) { System.out.println("Devel Library"); @@ -76,7 +76,6 @@ /** Get the Serial port prefixes for the running OS */ private String deviceDirectory; private String osName; - private static native String nativeGetVersion(); private native boolean registerKnownPorts(int PortType); private native boolean isPortPrefixValid(String dev); private native boolean testRead(String dev, int type); Index: RXTXVersion.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXVersion.java,v retrieving revision 1.2.2.31 diff -u -r1.2.2.31 RXTXVersion.java --- RXTXVersion.java 16 Oct 2004 16:20:35 -0000 1.2.2.31 +++ RXTXVersion.java 7 Apr 2005 09:29:04 -0000 @@ -36,6 +36,7 @@ private static String Version; static { + System.loadLibrary( "rxtxSerial" ); Version = "RXTX-2.1-7pre20"; } /** @@ -47,4 +48,5 @@ { return(Version); } + public static native String nativeGetVersion(); } Index: SerialImp.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v retrieving revision 1.46.2.181 diff -u -r1.46.2.181 SerialImp.c --- SerialImp.c 17 Oct 2004 09:48:56 -0000 1.46.2.181 +++ SerialImp.c 7 Apr 2005 09:29:07 -0000 @@ -116,6 +116,7 @@ * It will eventually be removed. * */ #define RXTXPort(foo) Java_gnu_io_RXTXPort_ ## foo +#define RXTXVersion(foo) Java_gnu_io_RXTXVersion_ ## foo #define RXTXCommDriver(foo) Java_gnu_io_RXTXCommDriver_ ## foo #if defined(__sun__) || defined(__hpux__) @@ -4001,7 +4002,7 @@ } /*---------------------------------------------------------- -RXTXCommDriver.nativeGetVersion +RXTXVersion.nativeGetVersion accept: none perform: return the current version @@ -4010,9 +4011,10 @@ comments: This is used to avoid mixing versions of the .jar and native library. First introduced in rxtx-1.5-9 + Moved from RXTXCommDriver to RXTXVersion in rxtx-2.1-7 ----------------------------------------------------------*/ -JNIEXPORT jstring JNICALL RXTXCommDriver(nativeGetVersion) (JNIEnv *env, +JNIEXPORT jstring JNICALL RXTXVersion(nativeGetVersion) (JNIEnv *env, jclass jclazz ) { return (*env)->NewStringUTF( env, "RXTX-2.1-7pre20" ); From ricardo.trindade at emation.pt Thu Apr 7 03:45:58 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 10:45:58 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: <42550156.2040908@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050407/05212451/attachment-0107.html From thomas.shulok at lmco.com Thu Apr 7 17:43:11 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Thu, 07 Apr 2005 19:43:11 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi There, I'm attempting to talk RS232 between an embedded Linux box and a Windows box. Everything connects up fine, and I can send and receive a simple sequence of bytes with no problems. However, if around 5 seconds goes by without me sending something, I get the following when I attempt to send. java.io.IOException: Input/output error in writeArray Stack trace: java/lang/Throwable.()V java/lang/Throwable.(Ljava/lang/String;)V java/io/IOException.(Ljava/lang/String;)V gnu/io/RXTXPort.writeArray([BIIZ)V gnu/io/RXTXPort$SerialOutputStream.write([B)V SerialTest.main([Ljava/lang/String;)V If there interval is shorter (say 2 seconds between sends), I have no problems. On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and librxtxSerial-2.0.7pre2.so. Any ideas? Thanks, Thom -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5b23dcf/attachment-0107.html From taj at www.linux.org.uk Thu Apr 7 19:22:36 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:22:36 +0100 (BST) Subject: [Rxtx] Input/output error in writeArray In-Reply-To: References: Message-ID: On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a Windows > box. Everything connects up fine, and I can send and receive a simple > sequence of bytes with no problems. However, if around 5 seconds goes > by without me sending something, I get the following when I attempt to > send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Apr 7 19:24:59 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:24:59 +0100 (BST) Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) Message-ID: hmm. This would not work from applets would it? -- Trent Jarvi taj at www.linux.org.uk ---------- Forwarded message ---------- Date: Thu, 07 Apr 2005 16:05:53 -0400 From: Chris Gaffney To: taj at www.linux.org.uk Subject: RXTX Libraries on Classpath fix Hi, I submitted a patch for RXTX a few weeks ago to allow for loading the native libraries from the classpath. Since sending it to you I found it wasn't working on windows. I've fixed the problem and created a new patch that should replace the older one. The actual change is a one line from a String.equals() to a String.startsWith(). Thanks for a great piece of software, -Chris Gaffney Grand Valley State University -------------- next part -------------- A non-text attachment was scrubbed... Name: libraries_on_classpath_fixed.patch Type: text/x-patch Size: 5617 bytes Desc: Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5d423b8/libraries_on_classpath_fixed-0107.bin From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From thomas.shulok at lmco.com Fri Apr 8 10:38:55 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Fri, 08 Apr 2005 12:38:55 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi Trent, Thanks for the prompt response. Before diving deeper, I was wondering if there is a timeout parameter somewhere in the stack that I have not set properly. Given the nature of the failure (only fails if the line has been idle for a few seconds), it feels like some kind of timeout issue... Thanks again, Thom -----Original Message----- From: rxtx-bounces at mail.linuxgrrls.org [mailto:rxtx-bounces at mail.linuxgrrls.org] On Behalf Of Trent Jarvi Sent: Thursday, April 07, 2005 6:23 PM To: Java RXTX discussion Subject: Re: [Rxtx] Input/output error in writeArray On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a > Windows box. Everything connects up fine, and I can send and receive > a simple sequence of bytes with no problems. However, if around 5 > seconds goes by without me sending something, I get the following when > I attempt to send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at mail.linuxgrrls.org http://mail.linuxgrrls.org/mailman/listinfo/rxtx From ricardo.trindade at emation.pt Mon Apr 4 09:17:23 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Mon, 04 Apr 2005 16:17:23 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot Message-ID: <42515A83.4050907@emation.pt> Hi, I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most recent stable snapshot), and get the following exception : It looks like rxtx has been compiled with jdk 1.5. If this was indeed the case, I think there is a compilation flag that generates code that runs on older jdks. java.lang.UnsupportedClassVersionError: gnu/io/UnsupportedCommOperationException (Unsupported major.minor version 49.0) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at java.net.URLClassLoader.defineClass(URLClassLoader.java:251) at java.net.URLClassLoader.access$100(URLClassLoader.java:55) at java.net.URLClassLoader$1.run(URLClassLoader.java:194) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:187) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:141) I'm trying to run it with 1.4. thanks Ricardo From taj at www.linux.org.uk Tue Apr 5 00:48:12 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 07:48:12 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42515A83.4050907@emation.pt> References: <42515A83.4050907@emation.pt> Message-ID: On Mon, 4 Apr 2005, Ricardo Trindade wrote: > Hi, > > I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most > recent stable snapshot), and get the following exception : > > It looks like rxtx has been compiled with jdk 1.5. If this was > indeed the case, I think there is a compilation flag that generates code > that runs on older jdks. > > java.lang.UnsupportedClassVersionError: > gnu/io/UnsupportedCommOperationException (Unsupported major.minor > version 49.0) [snip] Thanks Ricardo I recompiled the jar with javac -source 1.3 -target 1.3. That should cover most of the JRE's in use today. I also compiled the rxtx 2.0 x86_64 native library which appeared to be missing. I tried looking for flags to pass gcc 4.0 to make the native libraries more backwards compatible but only found options for C++ which is not used in rxtx. I've got a list of other bugs that I'll be going through in the next few weeks but for now I just left them with the same CVS filename - no code changes. ftp://ftp.qbang.org/pub/rxtx/rxtx-2.0-CVS-20050120-bins.tar.gz ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-CVS-20050120-bins.tar.gz -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Tue Apr 5 02:24:33 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 05 Apr 2005 09:24:33 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: References: <42515A83.4050907@emation.pt> Message-ID: <42524B41.3040300@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050405/5919abbb/attachment-0108.html From taj at www.linux.org.uk Tue Apr 5 03:00:29 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 10:00:29 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42524B41.3040300@emation.pt> References: <42515A83.4050907@emation.pt> <42524B41.3040300@emation.pt> Message-ID: On Tue, 5 Apr 2005, Ricardo Trindade wrote: > Will you anounce to the list when a new release is available ? > There will be several incremental releases announced here. Once those are done, we will release 2.1.7 and 2.0.7. -- Trent Jarvi taj at www.linux.org.uk From no_spam at somewhere.com Tue Apr 5 11:55:37 2005 From: no_spam at somewhere.com (no_spam@somewhere.com) Date: Tue, 5 Apr 2005 13:55:37 -0400 Subject: [Rxtx] Closing a port from an event listener results in a deadlock Message-ID: <20050405175537.GA21747@rcog.homelinux.net> On the message I sent on March 14, does anyone had the chance to try the modification? Or was it already fixed? (I haven't searched the archive extensively) Or maybe my message got catched by some spam filters? (it made it to the list archive though) Anyway, I would appreciate some feedback (through the list) Thanks From taj at www.linux.org.uk Tue Apr 5 14:42:28 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 21:42:28 +0100 (BST) Subject: [Rxtx] Closing a port from an event listener results in a deadlock In-Reply-To: <20050405175537.GA21747@rcog.homelinux.net> References: <20050405175537.GA21747@rcog.homelinux.net> Message-ID: On Tue, 5 Apr 2005 no_spam at somewhere.com wrote: > On the message I sent on March 14, does anyone had the chance to try the > modification? > > Or was it already fixed? (I haven't searched the archive extensively) > > Or maybe my message got catched by some spam filters? (it made it to the list > archive though) > > Anyway, I would appreciate some feedback (through the list) > The patch is here http://marc.theaimsgroup.com/?l=rxtx&m=111084488820288&w=2 I have applied this patch to a local copy but will not be doing formal testing for a couple weeks. I do not try to close ports from inside the eventListenter usually so I encourage any feedback also. If there are no problems reported, I expect this will go into rxtx 2.1-7. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Wed Apr 6 08:33:42 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Wed, 06 Apr 2005 15:33:42 +0100 Subject: [Rxtx] getting RXTX version Message-ID: <4253F346.50102@emation.pt> Hi, I want to make sure my deployments have the same version of RXTX jar and native lib. I know the version of the jar can be obtained in the Version class, but how can I obtain the native version ? I know RXTX prints to the console a warning if the version is different. Is there a way to programatically know is this is the case ? I would like to log that to our app's log thanks Ricardo From taj at www.linux.org.uk Wed Apr 6 15:10:20 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 6 Apr 2005 22:10:20 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4253F346.50102@emation.pt> References: <4253F346.50102@emation.pt> Message-ID: On Wed, 6 Apr 2005, Ricardo Trindade wrote: > Hi, > > I want to make sure my deployments have the same version of RXTX jar > and native lib. > > I know the version of the jar can be obtained in the Version class, > but how can I obtain the native version ? > > I know RXTX prints to the console a warning if the version is > different. Is there a way to programatically know is this is the case ? > > I would like to log that to our app's log > There isn't a suggested way of doing that right now. We could move things around and have a static String RXTXVersion.getNativeVersion() in future releases. Is this what you expected? This is not documented in commapi at all. I just tossed that in to catch conflicts while developing. It would be nice to have access in GUI applications though. It may be possible to access RXTXCommDriver.LibVersion right now. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Thu Apr 7 02:51:00 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 09:51:00 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> Message-ID: <4254F474.7020905@emation.pt> >There isn't a suggested way of doing that right now. We could move things >around and have a static String RXTXVersion.getNativeVersion() in future >releases. Is this what you expected? > > Yes, that would be perfect. >This is not documented in commapi at all. I just tossed that in to catch >conflicts while developing. It would be nice to have access in GUI >applications though. > >It may be possible to access RXTXCommDriver.LibVersion right now. > > > I tried, and I don't think it's possible. From taj at www.linux.org.uk Thu Apr 7 03:32:04 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 7 Apr 2005 10:32:04 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4254F474.7020905@emation.pt> References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: On Thu, 7 Apr 2005, Ricardo Trindade wrote: > > >There isn't a suggested way of doing that right now. We could move things > >around and have a static String RXTXVersion.getNativeVersion() in future > >releases. Is this what you expected? > > > > > > Yes, that would be perfect. > The attached should do what you want. You will still need to catch an exception for older versions... -- Trent Jarvi taj at www.linux.org.uk -------------- next part -------------- ? public_version.patch Index: RXTXCommDriver.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXCommDriver.java,v retrieving revision 1.16.2.51 diff -u -r1.16.2.51 RXTXCommDriver.java --- RXTXCommDriver.java 12 Oct 2004 09:13:30 -0000 1.16.2.51 +++ RXTXCommDriver.java 7 Apr 2005 09:29:04 -0000 @@ -54,7 +54,7 @@ the Library. */ String JarVersion = RXTXVersion.getVersion(); - String LibVersion = nativeGetVersion(); + String LibVersion = RXTXVersion.nativeGetVersion(); if ( devel ) { System.out.println("Devel Library"); @@ -76,7 +76,6 @@ /** Get the Serial port prefixes for the running OS */ private String deviceDirectory; private String osName; - private static native String nativeGetVersion(); private native boolean registerKnownPorts(int PortType); private native boolean isPortPrefixValid(String dev); private native boolean testRead(String dev, int type); Index: RXTXVersion.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXVersion.java,v retrieving revision 1.2.2.31 diff -u -r1.2.2.31 RXTXVersion.java --- RXTXVersion.java 16 Oct 2004 16:20:35 -0000 1.2.2.31 +++ RXTXVersion.java 7 Apr 2005 09:29:04 -0000 @@ -36,6 +36,7 @@ private static String Version; static { + System.loadLibrary( "rxtxSerial" ); Version = "RXTX-2.1-7pre20"; } /** @@ -47,4 +48,5 @@ { return(Version); } + public static native String nativeGetVersion(); } Index: SerialImp.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v retrieving revision 1.46.2.181 diff -u -r1.46.2.181 SerialImp.c --- SerialImp.c 17 Oct 2004 09:48:56 -0000 1.46.2.181 +++ SerialImp.c 7 Apr 2005 09:29:07 -0000 @@ -116,6 +116,7 @@ * It will eventually be removed. * */ #define RXTXPort(foo) Java_gnu_io_RXTXPort_ ## foo +#define RXTXVersion(foo) Java_gnu_io_RXTXVersion_ ## foo #define RXTXCommDriver(foo) Java_gnu_io_RXTXCommDriver_ ## foo #if defined(__sun__) || defined(__hpux__) @@ -4001,7 +4002,7 @@ } /*---------------------------------------------------------- -RXTXCommDriver.nativeGetVersion +RXTXVersion.nativeGetVersion accept: none perform: return the current version @@ -4010,9 +4011,10 @@ comments: This is used to avoid mixing versions of the .jar and native library. First introduced in rxtx-1.5-9 + Moved from RXTXCommDriver to RXTXVersion in rxtx-2.1-7 ----------------------------------------------------------*/ -JNIEXPORT jstring JNICALL RXTXCommDriver(nativeGetVersion) (JNIEnv *env, +JNIEXPORT jstring JNICALL RXTXVersion(nativeGetVersion) (JNIEnv *env, jclass jclazz ) { return (*env)->NewStringUTF( env, "RXTX-2.1-7pre20" ); From ricardo.trindade at emation.pt Thu Apr 7 03:45:58 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 10:45:58 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: <42550156.2040908@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050407/05212451/attachment-0108.html From thomas.shulok at lmco.com Thu Apr 7 17:43:11 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Thu, 07 Apr 2005 19:43:11 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi There, I'm attempting to talk RS232 between an embedded Linux box and a Windows box. Everything connects up fine, and I can send and receive a simple sequence of bytes with no problems. However, if around 5 seconds goes by without me sending something, I get the following when I attempt to send. java.io.IOException: Input/output error in writeArray Stack trace: java/lang/Throwable.()V java/lang/Throwable.(Ljava/lang/String;)V java/io/IOException.(Ljava/lang/String;)V gnu/io/RXTXPort.writeArray([BIIZ)V gnu/io/RXTXPort$SerialOutputStream.write([B)V SerialTest.main([Ljava/lang/String;)V If there interval is shorter (say 2 seconds between sends), I have no problems. On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and librxtxSerial-2.0.7pre2.so. Any ideas? Thanks, Thom -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5b23dcf/attachment-0108.html From taj at www.linux.org.uk Thu Apr 7 19:22:36 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:22:36 +0100 (BST) Subject: [Rxtx] Input/output error in writeArray In-Reply-To: References: Message-ID: On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a Windows > box. Everything connects up fine, and I can send and receive a simple > sequence of bytes with no problems. However, if around 5 seconds goes > by without me sending something, I get the following when I attempt to > send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Apr 7 19:24:59 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:24:59 +0100 (BST) Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) Message-ID: hmm. This would not work from applets would it? -- Trent Jarvi taj at www.linux.org.uk ---------- Forwarded message ---------- Date: Thu, 07 Apr 2005 16:05:53 -0400 From: Chris Gaffney To: taj at www.linux.org.uk Subject: RXTX Libraries on Classpath fix Hi, I submitted a patch for RXTX a few weeks ago to allow for loading the native libraries from the classpath. Since sending it to you I found it wasn't working on windows. I've fixed the problem and created a new patch that should replace the older one. The actual change is a one line from a String.equals() to a String.startsWith(). Thanks for a great piece of software, -Chris Gaffney Grand Valley State University -------------- next part -------------- A non-text attachment was scrubbed... Name: libraries_on_classpath_fixed.patch Type: text/x-patch Size: 5617 bytes Desc: Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5d423b8/libraries_on_classpath_fixed-0108.bin From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From thomas.shulok at lmco.com Fri Apr 8 10:38:55 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Fri, 08 Apr 2005 12:38:55 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi Trent, Thanks for the prompt response. Before diving deeper, I was wondering if there is a timeout parameter somewhere in the stack that I have not set properly. Given the nature of the failure (only fails if the line has been idle for a few seconds), it feels like some kind of timeout issue... Thanks again, Thom -----Original Message----- From: rxtx-bounces at mail.linuxgrrls.org [mailto:rxtx-bounces at mail.linuxgrrls.org] On Behalf Of Trent Jarvi Sent: Thursday, April 07, 2005 6:23 PM To: Java RXTX discussion Subject: Re: [Rxtx] Input/output error in writeArray On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a > Windows box. Everything connects up fine, and I can send and receive > a simple sequence of bytes with no problems. However, if around 5 > seconds goes by without me sending something, I get the following when > I attempt to send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at mail.linuxgrrls.org http://mail.linuxgrrls.org/mailman/listinfo/rxtx From ricardo.trindade at emation.pt Mon Apr 4 09:17:23 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Mon, 04 Apr 2005 16:17:23 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot Message-ID: <42515A83.4050907@emation.pt> Hi, I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most recent stable snapshot), and get the following exception : It looks like rxtx has been compiled with jdk 1.5. If this was indeed the case, I think there is a compilation flag that generates code that runs on older jdks. java.lang.UnsupportedClassVersionError: gnu/io/UnsupportedCommOperationException (Unsupported major.minor version 49.0) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at java.net.URLClassLoader.defineClass(URLClassLoader.java:251) at java.net.URLClassLoader.access$100(URLClassLoader.java:55) at java.net.URLClassLoader$1.run(URLClassLoader.java:194) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:187) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:141) I'm trying to run it with 1.4. thanks Ricardo From taj at www.linux.org.uk Tue Apr 5 00:48:12 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 07:48:12 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42515A83.4050907@emation.pt> References: <42515A83.4050907@emation.pt> Message-ID: On Mon, 4 Apr 2005, Ricardo Trindade wrote: > Hi, > > I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most > recent stable snapshot), and get the following exception : > > It looks like rxtx has been compiled with jdk 1.5. If this was > indeed the case, I think there is a compilation flag that generates code > that runs on older jdks. > > java.lang.UnsupportedClassVersionError: > gnu/io/UnsupportedCommOperationException (Unsupported major.minor > version 49.0) [snip] Thanks Ricardo I recompiled the jar with javac -source 1.3 -target 1.3. That should cover most of the JRE's in use today. I also compiled the rxtx 2.0 x86_64 native library which appeared to be missing. I tried looking for flags to pass gcc 4.0 to make the native libraries more backwards compatible but only found options for C++ which is not used in rxtx. I've got a list of other bugs that I'll be going through in the next few weeks but for now I just left them with the same CVS filename - no code changes. ftp://ftp.qbang.org/pub/rxtx/rxtx-2.0-CVS-20050120-bins.tar.gz ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-CVS-20050120-bins.tar.gz -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Tue Apr 5 02:24:33 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 05 Apr 2005 09:24:33 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: References: <42515A83.4050907@emation.pt> Message-ID: <42524B41.3040300@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050405/5919abbb/attachment-0109.html From taj at www.linux.org.uk Tue Apr 5 03:00:29 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 10:00:29 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42524B41.3040300@emation.pt> References: <42515A83.4050907@emation.pt> <42524B41.3040300@emation.pt> Message-ID: On Tue, 5 Apr 2005, Ricardo Trindade wrote: > Will you anounce to the list when a new release is available ? > There will be several incremental releases announced here. Once those are done, we will release 2.1.7 and 2.0.7. -- Trent Jarvi taj at www.linux.org.uk From no_spam at somewhere.com Tue Apr 5 11:55:37 2005 From: no_spam at somewhere.com (no_spam@somewhere.com) Date: Tue, 5 Apr 2005 13:55:37 -0400 Subject: [Rxtx] Closing a port from an event listener results in a deadlock Message-ID: <20050405175537.GA21747@rcog.homelinux.net> On the message I sent on March 14, does anyone had the chance to try the modification? Or was it already fixed? (I haven't searched the archive extensively) Or maybe my message got catched by some spam filters? (it made it to the list archive though) Anyway, I would appreciate some feedback (through the list) Thanks From taj at www.linux.org.uk Tue Apr 5 14:42:28 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 21:42:28 +0100 (BST) Subject: [Rxtx] Closing a port from an event listener results in a deadlock In-Reply-To: <20050405175537.GA21747@rcog.homelinux.net> References: <20050405175537.GA21747@rcog.homelinux.net> Message-ID: On Tue, 5 Apr 2005 no_spam at somewhere.com wrote: > On the message I sent on March 14, does anyone had the chance to try the > modification? > > Or was it already fixed? (I haven't searched the archive extensively) > > Or maybe my message got catched by some spam filters? (it made it to the list > archive though) > > Anyway, I would appreciate some feedback (through the list) > The patch is here http://marc.theaimsgroup.com/?l=rxtx&m=111084488820288&w=2 I have applied this patch to a local copy but will not be doing formal testing for a couple weeks. I do not try to close ports from inside the eventListenter usually so I encourage any feedback also. If there are no problems reported, I expect this will go into rxtx 2.1-7. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Wed Apr 6 08:33:42 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Wed, 06 Apr 2005 15:33:42 +0100 Subject: [Rxtx] getting RXTX version Message-ID: <4253F346.50102@emation.pt> Hi, I want to make sure my deployments have the same version of RXTX jar and native lib. I know the version of the jar can be obtained in the Version class, but how can I obtain the native version ? I know RXTX prints to the console a warning if the version is different. Is there a way to programatically know is this is the case ? I would like to log that to our app's log thanks Ricardo From taj at www.linux.org.uk Wed Apr 6 15:10:20 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 6 Apr 2005 22:10:20 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4253F346.50102@emation.pt> References: <4253F346.50102@emation.pt> Message-ID: On Wed, 6 Apr 2005, Ricardo Trindade wrote: > Hi, > > I want to make sure my deployments have the same version of RXTX jar > and native lib. > > I know the version of the jar can be obtained in the Version class, > but how can I obtain the native version ? > > I know RXTX prints to the console a warning if the version is > different. Is there a way to programatically know is this is the case ? > > I would like to log that to our app's log > There isn't a suggested way of doing that right now. We could move things around and have a static String RXTXVersion.getNativeVersion() in future releases. Is this what you expected? This is not documented in commapi at all. I just tossed that in to catch conflicts while developing. It would be nice to have access in GUI applications though. It may be possible to access RXTXCommDriver.LibVersion right now. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Thu Apr 7 02:51:00 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 09:51:00 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> Message-ID: <4254F474.7020905@emation.pt> >There isn't a suggested way of doing that right now. We could move things >around and have a static String RXTXVersion.getNativeVersion() in future >releases. Is this what you expected? > > Yes, that would be perfect. >This is not documented in commapi at all. I just tossed that in to catch >conflicts while developing. It would be nice to have access in GUI >applications though. > >It may be possible to access RXTXCommDriver.LibVersion right now. > > > I tried, and I don't think it's possible. From taj at www.linux.org.uk Thu Apr 7 03:32:04 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 7 Apr 2005 10:32:04 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4254F474.7020905@emation.pt> References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: On Thu, 7 Apr 2005, Ricardo Trindade wrote: > > >There isn't a suggested way of doing that right now. We could move things > >around and have a static String RXTXVersion.getNativeVersion() in future > >releases. Is this what you expected? > > > > > > Yes, that would be perfect. > The attached should do what you want. You will still need to catch an exception for older versions... -- Trent Jarvi taj at www.linux.org.uk -------------- next part -------------- ? public_version.patch Index: RXTXCommDriver.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXCommDriver.java,v retrieving revision 1.16.2.51 diff -u -r1.16.2.51 RXTXCommDriver.java --- RXTXCommDriver.java 12 Oct 2004 09:13:30 -0000 1.16.2.51 +++ RXTXCommDriver.java 7 Apr 2005 09:29:04 -0000 @@ -54,7 +54,7 @@ the Library. */ String JarVersion = RXTXVersion.getVersion(); - String LibVersion = nativeGetVersion(); + String LibVersion = RXTXVersion.nativeGetVersion(); if ( devel ) { System.out.println("Devel Library"); @@ -76,7 +76,6 @@ /** Get the Serial port prefixes for the running OS */ private String deviceDirectory; private String osName; - private static native String nativeGetVersion(); private native boolean registerKnownPorts(int PortType); private native boolean isPortPrefixValid(String dev); private native boolean testRead(String dev, int type); Index: RXTXVersion.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXVersion.java,v retrieving revision 1.2.2.31 diff -u -r1.2.2.31 RXTXVersion.java --- RXTXVersion.java 16 Oct 2004 16:20:35 -0000 1.2.2.31 +++ RXTXVersion.java 7 Apr 2005 09:29:04 -0000 @@ -36,6 +36,7 @@ private static String Version; static { + System.loadLibrary( "rxtxSerial" ); Version = "RXTX-2.1-7pre20"; } /** @@ -47,4 +48,5 @@ { return(Version); } + public static native String nativeGetVersion(); } Index: SerialImp.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v retrieving revision 1.46.2.181 diff -u -r1.46.2.181 SerialImp.c --- SerialImp.c 17 Oct 2004 09:48:56 -0000 1.46.2.181 +++ SerialImp.c 7 Apr 2005 09:29:07 -0000 @@ -116,6 +116,7 @@ * It will eventually be removed. * */ #define RXTXPort(foo) Java_gnu_io_RXTXPort_ ## foo +#define RXTXVersion(foo) Java_gnu_io_RXTXVersion_ ## foo #define RXTXCommDriver(foo) Java_gnu_io_RXTXCommDriver_ ## foo #if defined(__sun__) || defined(__hpux__) @@ -4001,7 +4002,7 @@ } /*---------------------------------------------------------- -RXTXCommDriver.nativeGetVersion +RXTXVersion.nativeGetVersion accept: none perform: return the current version @@ -4010,9 +4011,10 @@ comments: This is used to avoid mixing versions of the .jar and native library. First introduced in rxtx-1.5-9 + Moved from RXTXCommDriver to RXTXVersion in rxtx-2.1-7 ----------------------------------------------------------*/ -JNIEXPORT jstring JNICALL RXTXCommDriver(nativeGetVersion) (JNIEnv *env, +JNIEXPORT jstring JNICALL RXTXVersion(nativeGetVersion) (JNIEnv *env, jclass jclazz ) { return (*env)->NewStringUTF( env, "RXTX-2.1-7pre20" ); From ricardo.trindade at emation.pt Thu Apr 7 03:45:58 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 10:45:58 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: <42550156.2040908@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050407/05212451/attachment-0109.html From thomas.shulok at lmco.com Thu Apr 7 17:43:11 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Thu, 07 Apr 2005 19:43:11 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi There, I'm attempting to talk RS232 between an embedded Linux box and a Windows box. Everything connects up fine, and I can send and receive a simple sequence of bytes with no problems. However, if around 5 seconds goes by without me sending something, I get the following when I attempt to send. java.io.IOException: Input/output error in writeArray Stack trace: java/lang/Throwable.()V java/lang/Throwable.(Ljava/lang/String;)V java/io/IOException.(Ljava/lang/String;)V gnu/io/RXTXPort.writeArray([BIIZ)V gnu/io/RXTXPort$SerialOutputStream.write([B)V SerialTest.main([Ljava/lang/String;)V If there interval is shorter (say 2 seconds between sends), I have no problems. On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and librxtxSerial-2.0.7pre2.so. Any ideas? Thanks, Thom -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5b23dcf/attachment-0109.html From taj at www.linux.org.uk Thu Apr 7 19:22:36 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:22:36 +0100 (BST) Subject: [Rxtx] Input/output error in writeArray In-Reply-To: References: Message-ID: On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a Windows > box. Everything connects up fine, and I can send and receive a simple > sequence of bytes with no problems. However, if around 5 seconds goes > by without me sending something, I get the following when I attempt to > send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Apr 7 19:24:59 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:24:59 +0100 (BST) Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) Message-ID: hmm. This would not work from applets would it? -- Trent Jarvi taj at www.linux.org.uk ---------- Forwarded message ---------- Date: Thu, 07 Apr 2005 16:05:53 -0400 From: Chris Gaffney To: taj at www.linux.org.uk Subject: RXTX Libraries on Classpath fix Hi, I submitted a patch for RXTX a few weeks ago to allow for loading the native libraries from the classpath. Since sending it to you I found it wasn't working on windows. I've fixed the problem and created a new patch that should replace the older one. The actual change is a one line from a String.equals() to a String.startsWith(). Thanks for a great piece of software, -Chris Gaffney Grand Valley State University -------------- next part -------------- A non-text attachment was scrubbed... Name: libraries_on_classpath_fixed.patch Type: text/x-patch Size: 5617 bytes Desc: Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5d423b8/libraries_on_classpath_fixed-0109.bin From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From thomas.shulok at lmco.com Fri Apr 8 10:38:55 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Fri, 08 Apr 2005 12:38:55 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi Trent, Thanks for the prompt response. Before diving deeper, I was wondering if there is a timeout parameter somewhere in the stack that I have not set properly. Given the nature of the failure (only fails if the line has been idle for a few seconds), it feels like some kind of timeout issue... Thanks again, Thom -----Original Message----- From: rxtx-bounces at mail.linuxgrrls.org [mailto:rxtx-bounces at mail.linuxgrrls.org] On Behalf Of Trent Jarvi Sent: Thursday, April 07, 2005 6:23 PM To: Java RXTX discussion Subject: Re: [Rxtx] Input/output error in writeArray On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a > Windows box. Everything connects up fine, and I can send and receive > a simple sequence of bytes with no problems. However, if around 5 > seconds goes by without me sending something, I get the following when > I attempt to send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at mail.linuxgrrls.org http://mail.linuxgrrls.org/mailman/listinfo/rxtx From ricardo.trindade at emation.pt Mon Apr 4 09:17:23 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Mon, 04 Apr 2005 16:17:23 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot Message-ID: <42515A83.4050907@emation.pt> Hi, I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most recent stable snapshot), and get the following exception : It looks like rxtx has been compiled with jdk 1.5. If this was indeed the case, I think there is a compilation flag that generates code that runs on older jdks. java.lang.UnsupportedClassVersionError: gnu/io/UnsupportedCommOperationException (Unsupported major.minor version 49.0) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at java.net.URLClassLoader.defineClass(URLClassLoader.java:251) at java.net.URLClassLoader.access$100(URLClassLoader.java:55) at java.net.URLClassLoader$1.run(URLClassLoader.java:194) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:187) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:141) I'm trying to run it with 1.4. thanks Ricardo From taj at www.linux.org.uk Tue Apr 5 00:48:12 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 07:48:12 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42515A83.4050907@emation.pt> References: <42515A83.4050907@emation.pt> Message-ID: On Mon, 4 Apr 2005, Ricardo Trindade wrote: > Hi, > > I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most > recent stable snapshot), and get the following exception : > > It looks like rxtx has been compiled with jdk 1.5. If this was > indeed the case, I think there is a compilation flag that generates code > that runs on older jdks. > > java.lang.UnsupportedClassVersionError: > gnu/io/UnsupportedCommOperationException (Unsupported major.minor > version 49.0) [snip] Thanks Ricardo I recompiled the jar with javac -source 1.3 -target 1.3. That should cover most of the JRE's in use today. I also compiled the rxtx 2.0 x86_64 native library which appeared to be missing. I tried looking for flags to pass gcc 4.0 to make the native libraries more backwards compatible but only found options for C++ which is not used in rxtx. I've got a list of other bugs that I'll be going through in the next few weeks but for now I just left them with the same CVS filename - no code changes. ftp://ftp.qbang.org/pub/rxtx/rxtx-2.0-CVS-20050120-bins.tar.gz ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-CVS-20050120-bins.tar.gz -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Tue Apr 5 02:24:33 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 05 Apr 2005 09:24:33 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: References: <42515A83.4050907@emation.pt> Message-ID: <42524B41.3040300@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050405/5919abbb/attachment-0110.html From taj at www.linux.org.uk Tue Apr 5 03:00:29 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 10:00:29 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42524B41.3040300@emation.pt> References: <42515A83.4050907@emation.pt> <42524B41.3040300@emation.pt> Message-ID: On Tue, 5 Apr 2005, Ricardo Trindade wrote: > Will you anounce to the list when a new release is available ? > There will be several incremental releases announced here. Once those are done, we will release 2.1.7 and 2.0.7. -- Trent Jarvi taj at www.linux.org.uk From no_spam at somewhere.com Tue Apr 5 11:55:37 2005 From: no_spam at somewhere.com (no_spam@somewhere.com) Date: Tue, 5 Apr 2005 13:55:37 -0400 Subject: [Rxtx] Closing a port from an event listener results in a deadlock Message-ID: <20050405175537.GA21747@rcog.homelinux.net> On the message I sent on March 14, does anyone had the chance to try the modification? Or was it already fixed? (I haven't searched the archive extensively) Or maybe my message got catched by some spam filters? (it made it to the list archive though) Anyway, I would appreciate some feedback (through the list) Thanks From taj at www.linux.org.uk Tue Apr 5 14:42:28 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 21:42:28 +0100 (BST) Subject: [Rxtx] Closing a port from an event listener results in a deadlock In-Reply-To: <20050405175537.GA21747@rcog.homelinux.net> References: <20050405175537.GA21747@rcog.homelinux.net> Message-ID: On Tue, 5 Apr 2005 no_spam at somewhere.com wrote: > On the message I sent on March 14, does anyone had the chance to try the > modification? > > Or was it already fixed? (I haven't searched the archive extensively) > > Or maybe my message got catched by some spam filters? (it made it to the list > archive though) > > Anyway, I would appreciate some feedback (through the list) > The patch is here http://marc.theaimsgroup.com/?l=rxtx&m=111084488820288&w=2 I have applied this patch to a local copy but will not be doing formal testing for a couple weeks. I do not try to close ports from inside the eventListenter usually so I encourage any feedback also. If there are no problems reported, I expect this will go into rxtx 2.1-7. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Wed Apr 6 08:33:42 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Wed, 06 Apr 2005 15:33:42 +0100 Subject: [Rxtx] getting RXTX version Message-ID: <4253F346.50102@emation.pt> Hi, I want to make sure my deployments have the same version of RXTX jar and native lib. I know the version of the jar can be obtained in the Version class, but how can I obtain the native version ? I know RXTX prints to the console a warning if the version is different. Is there a way to programatically know is this is the case ? I would like to log that to our app's log thanks Ricardo From taj at www.linux.org.uk Wed Apr 6 15:10:20 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 6 Apr 2005 22:10:20 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4253F346.50102@emation.pt> References: <4253F346.50102@emation.pt> Message-ID: On Wed, 6 Apr 2005, Ricardo Trindade wrote: > Hi, > > I want to make sure my deployments have the same version of RXTX jar > and native lib. > > I know the version of the jar can be obtained in the Version class, > but how can I obtain the native version ? > > I know RXTX prints to the console a warning if the version is > different. Is there a way to programatically know is this is the case ? > > I would like to log that to our app's log > There isn't a suggested way of doing that right now. We could move things around and have a static String RXTXVersion.getNativeVersion() in future releases. Is this what you expected? This is not documented in commapi at all. I just tossed that in to catch conflicts while developing. It would be nice to have access in GUI applications though. It may be possible to access RXTXCommDriver.LibVersion right now. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Thu Apr 7 02:51:00 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 09:51:00 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> Message-ID: <4254F474.7020905@emation.pt> >There isn't a suggested way of doing that right now. We could move things >around and have a static String RXTXVersion.getNativeVersion() in future >releases. Is this what you expected? > > Yes, that would be perfect. >This is not documented in commapi at all. I just tossed that in to catch >conflicts while developing. It would be nice to have access in GUI >applications though. > >It may be possible to access RXTXCommDriver.LibVersion right now. > > > I tried, and I don't think it's possible. From taj at www.linux.org.uk Thu Apr 7 03:32:04 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 7 Apr 2005 10:32:04 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4254F474.7020905@emation.pt> References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: On Thu, 7 Apr 2005, Ricardo Trindade wrote: > > >There isn't a suggested way of doing that right now. We could move things > >around and have a static String RXTXVersion.getNativeVersion() in future > >releases. Is this what you expected? > > > > > > Yes, that would be perfect. > The attached should do what you want. You will still need to catch an exception for older versions... -- Trent Jarvi taj at www.linux.org.uk -------------- next part -------------- ? public_version.patch Index: RXTXCommDriver.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXCommDriver.java,v retrieving revision 1.16.2.51 diff -u -r1.16.2.51 RXTXCommDriver.java --- RXTXCommDriver.java 12 Oct 2004 09:13:30 -0000 1.16.2.51 +++ RXTXCommDriver.java 7 Apr 2005 09:29:04 -0000 @@ -54,7 +54,7 @@ the Library. */ String JarVersion = RXTXVersion.getVersion(); - String LibVersion = nativeGetVersion(); + String LibVersion = RXTXVersion.nativeGetVersion(); if ( devel ) { System.out.println("Devel Library"); @@ -76,7 +76,6 @@ /** Get the Serial port prefixes for the running OS */ private String deviceDirectory; private String osName; - private static native String nativeGetVersion(); private native boolean registerKnownPorts(int PortType); private native boolean isPortPrefixValid(String dev); private native boolean testRead(String dev, int type); Index: RXTXVersion.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXVersion.java,v retrieving revision 1.2.2.31 diff -u -r1.2.2.31 RXTXVersion.java --- RXTXVersion.java 16 Oct 2004 16:20:35 -0000 1.2.2.31 +++ RXTXVersion.java 7 Apr 2005 09:29:04 -0000 @@ -36,6 +36,7 @@ private static String Version; static { + System.loadLibrary( "rxtxSerial" ); Version = "RXTX-2.1-7pre20"; } /** @@ -47,4 +48,5 @@ { return(Version); } + public static native String nativeGetVersion(); } Index: SerialImp.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v retrieving revision 1.46.2.181 diff -u -r1.46.2.181 SerialImp.c --- SerialImp.c 17 Oct 2004 09:48:56 -0000 1.46.2.181 +++ SerialImp.c 7 Apr 2005 09:29:07 -0000 @@ -116,6 +116,7 @@ * It will eventually be removed. * */ #define RXTXPort(foo) Java_gnu_io_RXTXPort_ ## foo +#define RXTXVersion(foo) Java_gnu_io_RXTXVersion_ ## foo #define RXTXCommDriver(foo) Java_gnu_io_RXTXCommDriver_ ## foo #if defined(__sun__) || defined(__hpux__) @@ -4001,7 +4002,7 @@ } /*---------------------------------------------------------- -RXTXCommDriver.nativeGetVersion +RXTXVersion.nativeGetVersion accept: none perform: return the current version @@ -4010,9 +4011,10 @@ comments: This is used to avoid mixing versions of the .jar and native library. First introduced in rxtx-1.5-9 + Moved from RXTXCommDriver to RXTXVersion in rxtx-2.1-7 ----------------------------------------------------------*/ -JNIEXPORT jstring JNICALL RXTXCommDriver(nativeGetVersion) (JNIEnv *env, +JNIEXPORT jstring JNICALL RXTXVersion(nativeGetVersion) (JNIEnv *env, jclass jclazz ) { return (*env)->NewStringUTF( env, "RXTX-2.1-7pre20" ); From ricardo.trindade at emation.pt Thu Apr 7 03:45:58 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 10:45:58 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: <42550156.2040908@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050407/05212451/attachment-0110.html From thomas.shulok at lmco.com Thu Apr 7 17:43:11 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Thu, 07 Apr 2005 19:43:11 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi There, I'm attempting to talk RS232 between an embedded Linux box and a Windows box. Everything connects up fine, and I can send and receive a simple sequence of bytes with no problems. However, if around 5 seconds goes by without me sending something, I get the following when I attempt to send. java.io.IOException: Input/output error in writeArray Stack trace: java/lang/Throwable.()V java/lang/Throwable.(Ljava/lang/String;)V java/io/IOException.(Ljava/lang/String;)V gnu/io/RXTXPort.writeArray([BIIZ)V gnu/io/RXTXPort$SerialOutputStream.write([B)V SerialTest.main([Ljava/lang/String;)V If there interval is shorter (say 2 seconds between sends), I have no problems. On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and librxtxSerial-2.0.7pre2.so. Any ideas? Thanks, Thom -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5b23dcf/attachment-0110.html From taj at www.linux.org.uk Thu Apr 7 19:22:36 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:22:36 +0100 (BST) Subject: [Rxtx] Input/output error in writeArray In-Reply-To: References: Message-ID: On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a Windows > box. Everything connects up fine, and I can send and receive a simple > sequence of bytes with no problems. However, if around 5 seconds goes > by without me sending something, I get the following when I attempt to > send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Apr 7 19:24:59 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:24:59 +0100 (BST) Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) Message-ID: hmm. This would not work from applets would it? -- Trent Jarvi taj at www.linux.org.uk ---------- Forwarded message ---------- Date: Thu, 07 Apr 2005 16:05:53 -0400 From: Chris Gaffney To: taj at www.linux.org.uk Subject: RXTX Libraries on Classpath fix Hi, I submitted a patch for RXTX a few weeks ago to allow for loading the native libraries from the classpath. Since sending it to you I found it wasn't working on windows. I've fixed the problem and created a new patch that should replace the older one. The actual change is a one line from a String.equals() to a String.startsWith(). Thanks for a great piece of software, -Chris Gaffney Grand Valley State University -------------- next part -------------- A non-text attachment was scrubbed... Name: libraries_on_classpath_fixed.patch Type: text/x-patch Size: 5617 bytes Desc: Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5d423b8/libraries_on_classpath_fixed-0110.bin From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From thomas.shulok at lmco.com Fri Apr 8 10:38:55 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Fri, 08 Apr 2005 12:38:55 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi Trent, Thanks for the prompt response. Before diving deeper, I was wondering if there is a timeout parameter somewhere in the stack that I have not set properly. Given the nature of the failure (only fails if the line has been idle for a few seconds), it feels like some kind of timeout issue... Thanks again, Thom -----Original Message----- From: rxtx-bounces at mail.linuxgrrls.org [mailto:rxtx-bounces at mail.linuxgrrls.org] On Behalf Of Trent Jarvi Sent: Thursday, April 07, 2005 6:23 PM To: Java RXTX discussion Subject: Re: [Rxtx] Input/output error in writeArray On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a > Windows box. Everything connects up fine, and I can send and receive > a simple sequence of bytes with no problems. However, if around 5 > seconds goes by without me sending something, I get the following when > I attempt to send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at mail.linuxgrrls.org http://mail.linuxgrrls.org/mailman/listinfo/rxtx From ricardo.trindade at emation.pt Mon Apr 4 09:17:23 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Mon, 04 Apr 2005 16:17:23 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot Message-ID: <42515A83.4050907@emation.pt> Hi, I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most recent stable snapshot), and get the following exception : It looks like rxtx has been compiled with jdk 1.5. If this was indeed the case, I think there is a compilation flag that generates code that runs on older jdks. java.lang.UnsupportedClassVersionError: gnu/io/UnsupportedCommOperationException (Unsupported major.minor version 49.0) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at java.net.URLClassLoader.defineClass(URLClassLoader.java:251) at java.net.URLClassLoader.access$100(URLClassLoader.java:55) at java.net.URLClassLoader$1.run(URLClassLoader.java:194) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:187) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:141) I'm trying to run it with 1.4. thanks Ricardo From taj at www.linux.org.uk Tue Apr 5 00:48:12 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 07:48:12 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42515A83.4050907@emation.pt> References: <42515A83.4050907@emation.pt> Message-ID: On Mon, 4 Apr 2005, Ricardo Trindade wrote: > Hi, > > I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most > recent stable snapshot), and get the following exception : > > It looks like rxtx has been compiled with jdk 1.5. If this was > indeed the case, I think there is a compilation flag that generates code > that runs on older jdks. > > java.lang.UnsupportedClassVersionError: > gnu/io/UnsupportedCommOperationException (Unsupported major.minor > version 49.0) [snip] Thanks Ricardo I recompiled the jar with javac -source 1.3 -target 1.3. That should cover most of the JRE's in use today. I also compiled the rxtx 2.0 x86_64 native library which appeared to be missing. I tried looking for flags to pass gcc 4.0 to make the native libraries more backwards compatible but only found options for C++ which is not used in rxtx. I've got a list of other bugs that I'll be going through in the next few weeks but for now I just left them with the same CVS filename - no code changes. ftp://ftp.qbang.org/pub/rxtx/rxtx-2.0-CVS-20050120-bins.tar.gz ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-CVS-20050120-bins.tar.gz -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Tue Apr 5 02:24:33 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 05 Apr 2005 09:24:33 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: References: <42515A83.4050907@emation.pt> Message-ID: <42524B41.3040300@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050405/5919abbb/attachment-0111.html From taj at www.linux.org.uk Tue Apr 5 03:00:29 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 10:00:29 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42524B41.3040300@emation.pt> References: <42515A83.4050907@emation.pt> <42524B41.3040300@emation.pt> Message-ID: On Tue, 5 Apr 2005, Ricardo Trindade wrote: > Will you anounce to the list when a new release is available ? > There will be several incremental releases announced here. Once those are done, we will release 2.1.7 and 2.0.7. -- Trent Jarvi taj at www.linux.org.uk From no_spam at somewhere.com Tue Apr 5 11:55:37 2005 From: no_spam at somewhere.com (no_spam@somewhere.com) Date: Tue, 5 Apr 2005 13:55:37 -0400 Subject: [Rxtx] Closing a port from an event listener results in a deadlock Message-ID: <20050405175537.GA21747@rcog.homelinux.net> On the message I sent on March 14, does anyone had the chance to try the modification? Or was it already fixed? (I haven't searched the archive extensively) Or maybe my message got catched by some spam filters? (it made it to the list archive though) Anyway, I would appreciate some feedback (through the list) Thanks From taj at www.linux.org.uk Tue Apr 5 14:42:28 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 21:42:28 +0100 (BST) Subject: [Rxtx] Closing a port from an event listener results in a deadlock In-Reply-To: <20050405175537.GA21747@rcog.homelinux.net> References: <20050405175537.GA21747@rcog.homelinux.net> Message-ID: On Tue, 5 Apr 2005 no_spam at somewhere.com wrote: > On the message I sent on March 14, does anyone had the chance to try the > modification? > > Or was it already fixed? (I haven't searched the archive extensively) > > Or maybe my message got catched by some spam filters? (it made it to the list > archive though) > > Anyway, I would appreciate some feedback (through the list) > The patch is here http://marc.theaimsgroup.com/?l=rxtx&m=111084488820288&w=2 I have applied this patch to a local copy but will not be doing formal testing for a couple weeks. I do not try to close ports from inside the eventListenter usually so I encourage any feedback also. If there are no problems reported, I expect this will go into rxtx 2.1-7. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Wed Apr 6 08:33:42 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Wed, 06 Apr 2005 15:33:42 +0100 Subject: [Rxtx] getting RXTX version Message-ID: <4253F346.50102@emation.pt> Hi, I want to make sure my deployments have the same version of RXTX jar and native lib. I know the version of the jar can be obtained in the Version class, but how can I obtain the native version ? I know RXTX prints to the console a warning if the version is different. Is there a way to programatically know is this is the case ? I would like to log that to our app's log thanks Ricardo From taj at www.linux.org.uk Wed Apr 6 15:10:20 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 6 Apr 2005 22:10:20 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4253F346.50102@emation.pt> References: <4253F346.50102@emation.pt> Message-ID: On Wed, 6 Apr 2005, Ricardo Trindade wrote: > Hi, > > I want to make sure my deployments have the same version of RXTX jar > and native lib. > > I know the version of the jar can be obtained in the Version class, > but how can I obtain the native version ? > > I know RXTX prints to the console a warning if the version is > different. Is there a way to programatically know is this is the case ? > > I would like to log that to our app's log > There isn't a suggested way of doing that right now. We could move things around and have a static String RXTXVersion.getNativeVersion() in future releases. Is this what you expected? This is not documented in commapi at all. I just tossed that in to catch conflicts while developing. It would be nice to have access in GUI applications though. It may be possible to access RXTXCommDriver.LibVersion right now. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Thu Apr 7 02:51:00 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 09:51:00 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> Message-ID: <4254F474.7020905@emation.pt> >There isn't a suggested way of doing that right now. We could move things >around and have a static String RXTXVersion.getNativeVersion() in future >releases. Is this what you expected? > > Yes, that would be perfect. >This is not documented in commapi at all. I just tossed that in to catch >conflicts while developing. It would be nice to have access in GUI >applications though. > >It may be possible to access RXTXCommDriver.LibVersion right now. > > > I tried, and I don't think it's possible. From taj at www.linux.org.uk Thu Apr 7 03:32:04 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 7 Apr 2005 10:32:04 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4254F474.7020905@emation.pt> References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: On Thu, 7 Apr 2005, Ricardo Trindade wrote: > > >There isn't a suggested way of doing that right now. We could move things > >around and have a static String RXTXVersion.getNativeVersion() in future > >releases. Is this what you expected? > > > > > > Yes, that would be perfect. > The attached should do what you want. You will still need to catch an exception for older versions... -- Trent Jarvi taj at www.linux.org.uk -------------- next part -------------- ? public_version.patch Index: RXTXCommDriver.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXCommDriver.java,v retrieving revision 1.16.2.51 diff -u -r1.16.2.51 RXTXCommDriver.java --- RXTXCommDriver.java 12 Oct 2004 09:13:30 -0000 1.16.2.51 +++ RXTXCommDriver.java 7 Apr 2005 09:29:04 -0000 @@ -54,7 +54,7 @@ the Library. */ String JarVersion = RXTXVersion.getVersion(); - String LibVersion = nativeGetVersion(); + String LibVersion = RXTXVersion.nativeGetVersion(); if ( devel ) { System.out.println("Devel Library"); @@ -76,7 +76,6 @@ /** Get the Serial port prefixes for the running OS */ private String deviceDirectory; private String osName; - private static native String nativeGetVersion(); private native boolean registerKnownPorts(int PortType); private native boolean isPortPrefixValid(String dev); private native boolean testRead(String dev, int type); Index: RXTXVersion.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXVersion.java,v retrieving revision 1.2.2.31 diff -u -r1.2.2.31 RXTXVersion.java --- RXTXVersion.java 16 Oct 2004 16:20:35 -0000 1.2.2.31 +++ RXTXVersion.java 7 Apr 2005 09:29:04 -0000 @@ -36,6 +36,7 @@ private static String Version; static { + System.loadLibrary( "rxtxSerial" ); Version = "RXTX-2.1-7pre20"; } /** @@ -47,4 +48,5 @@ { return(Version); } + public static native String nativeGetVersion(); } Index: SerialImp.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v retrieving revision 1.46.2.181 diff -u -r1.46.2.181 SerialImp.c --- SerialImp.c 17 Oct 2004 09:48:56 -0000 1.46.2.181 +++ SerialImp.c 7 Apr 2005 09:29:07 -0000 @@ -116,6 +116,7 @@ * It will eventually be removed. * */ #define RXTXPort(foo) Java_gnu_io_RXTXPort_ ## foo +#define RXTXVersion(foo) Java_gnu_io_RXTXVersion_ ## foo #define RXTXCommDriver(foo) Java_gnu_io_RXTXCommDriver_ ## foo #if defined(__sun__) || defined(__hpux__) @@ -4001,7 +4002,7 @@ } /*---------------------------------------------------------- -RXTXCommDriver.nativeGetVersion +RXTXVersion.nativeGetVersion accept: none perform: return the current version @@ -4010,9 +4011,10 @@ comments: This is used to avoid mixing versions of the .jar and native library. First introduced in rxtx-1.5-9 + Moved from RXTXCommDriver to RXTXVersion in rxtx-2.1-7 ----------------------------------------------------------*/ -JNIEXPORT jstring JNICALL RXTXCommDriver(nativeGetVersion) (JNIEnv *env, +JNIEXPORT jstring JNICALL RXTXVersion(nativeGetVersion) (JNIEnv *env, jclass jclazz ) { return (*env)->NewStringUTF( env, "RXTX-2.1-7pre20" ); From ricardo.trindade at emation.pt Thu Apr 7 03:45:58 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 10:45:58 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: <42550156.2040908@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050407/05212451/attachment-0111.html From thomas.shulok at lmco.com Thu Apr 7 17:43:11 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Thu, 07 Apr 2005 19:43:11 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi There, I'm attempting to talk RS232 between an embedded Linux box and a Windows box. Everything connects up fine, and I can send and receive a simple sequence of bytes with no problems. However, if around 5 seconds goes by without me sending something, I get the following when I attempt to send. java.io.IOException: Input/output error in writeArray Stack trace: java/lang/Throwable.()V java/lang/Throwable.(Ljava/lang/String;)V java/io/IOException.(Ljava/lang/String;)V gnu/io/RXTXPort.writeArray([BIIZ)V gnu/io/RXTXPort$SerialOutputStream.write([B)V SerialTest.main([Ljava/lang/String;)V If there interval is shorter (say 2 seconds between sends), I have no problems. On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and librxtxSerial-2.0.7pre2.so. Any ideas? Thanks, Thom -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5b23dcf/attachment-0111.html From taj at www.linux.org.uk Thu Apr 7 19:22:36 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:22:36 +0100 (BST) Subject: [Rxtx] Input/output error in writeArray In-Reply-To: References: Message-ID: On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a Windows > box. Everything connects up fine, and I can send and receive a simple > sequence of bytes with no problems. However, if around 5 seconds goes > by without me sending something, I get the following when I attempt to > send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Apr 7 19:24:59 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:24:59 +0100 (BST) Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) Message-ID: hmm. This would not work from applets would it? -- Trent Jarvi taj at www.linux.org.uk ---------- Forwarded message ---------- Date: Thu, 07 Apr 2005 16:05:53 -0400 From: Chris Gaffney To: taj at www.linux.org.uk Subject: RXTX Libraries on Classpath fix Hi, I submitted a patch for RXTX a few weeks ago to allow for loading the native libraries from the classpath. Since sending it to you I found it wasn't working on windows. I've fixed the problem and created a new patch that should replace the older one. The actual change is a one line from a String.equals() to a String.startsWith(). Thanks for a great piece of software, -Chris Gaffney Grand Valley State University -------------- next part -------------- A non-text attachment was scrubbed... Name: libraries_on_classpath_fixed.patch Type: text/x-patch Size: 5617 bytes Desc: Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5d423b8/libraries_on_classpath_fixed-0111.bin From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From thomas.shulok at lmco.com Fri Apr 8 10:38:55 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Fri, 08 Apr 2005 12:38:55 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi Trent, Thanks for the prompt response. Before diving deeper, I was wondering if there is a timeout parameter somewhere in the stack that I have not set properly. Given the nature of the failure (only fails if the line has been idle for a few seconds), it feels like some kind of timeout issue... Thanks again, Thom -----Original Message----- From: rxtx-bounces at mail.linuxgrrls.org [mailto:rxtx-bounces at mail.linuxgrrls.org] On Behalf Of Trent Jarvi Sent: Thursday, April 07, 2005 6:23 PM To: Java RXTX discussion Subject: Re: [Rxtx] Input/output error in writeArray On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a > Windows box. Everything connects up fine, and I can send and receive > a simple sequence of bytes with no problems. However, if around 5 > seconds goes by without me sending something, I get the following when > I attempt to send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at mail.linuxgrrls.org http://mail.linuxgrrls.org/mailman/listinfo/rxtx From ricardo.trindade at emation.pt Mon Apr 4 09:17:23 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Mon, 04 Apr 2005 16:17:23 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot Message-ID: <42515A83.4050907@emation.pt> Hi, I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most recent stable snapshot), and get the following exception : It looks like rxtx has been compiled with jdk 1.5. If this was indeed the case, I think there is a compilation flag that generates code that runs on older jdks. java.lang.UnsupportedClassVersionError: gnu/io/UnsupportedCommOperationException (Unsupported major.minor version 49.0) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at java.net.URLClassLoader.defineClass(URLClassLoader.java:251) at java.net.URLClassLoader.access$100(URLClassLoader.java:55) at java.net.URLClassLoader$1.run(URLClassLoader.java:194) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:187) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:141) I'm trying to run it with 1.4. thanks Ricardo From taj at www.linux.org.uk Tue Apr 5 00:48:12 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 07:48:12 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42515A83.4050907@emation.pt> References: <42515A83.4050907@emation.pt> Message-ID: On Mon, 4 Apr 2005, Ricardo Trindade wrote: > Hi, > > I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most > recent stable snapshot), and get the following exception : > > It looks like rxtx has been compiled with jdk 1.5. If this was > indeed the case, I think there is a compilation flag that generates code > that runs on older jdks. > > java.lang.UnsupportedClassVersionError: > gnu/io/UnsupportedCommOperationException (Unsupported major.minor > version 49.0) [snip] Thanks Ricardo I recompiled the jar with javac -source 1.3 -target 1.3. That should cover most of the JRE's in use today. I also compiled the rxtx 2.0 x86_64 native library which appeared to be missing. I tried looking for flags to pass gcc 4.0 to make the native libraries more backwards compatible but only found options for C++ which is not used in rxtx. I've got a list of other bugs that I'll be going through in the next few weeks but for now I just left them with the same CVS filename - no code changes. ftp://ftp.qbang.org/pub/rxtx/rxtx-2.0-CVS-20050120-bins.tar.gz ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-CVS-20050120-bins.tar.gz -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Tue Apr 5 02:24:33 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 05 Apr 2005 09:24:33 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: References: <42515A83.4050907@emation.pt> Message-ID: <42524B41.3040300@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050405/5919abbb/attachment-0112.html From taj at www.linux.org.uk Tue Apr 5 03:00:29 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 10:00:29 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42524B41.3040300@emation.pt> References: <42515A83.4050907@emation.pt> <42524B41.3040300@emation.pt> Message-ID: On Tue, 5 Apr 2005, Ricardo Trindade wrote: > Will you anounce to the list when a new release is available ? > There will be several incremental releases announced here. Once those are done, we will release 2.1.7 and 2.0.7. -- Trent Jarvi taj at www.linux.org.uk From no_spam at somewhere.com Tue Apr 5 11:55:37 2005 From: no_spam at somewhere.com (no_spam@somewhere.com) Date: Tue, 5 Apr 2005 13:55:37 -0400 Subject: [Rxtx] Closing a port from an event listener results in a deadlock Message-ID: <20050405175537.GA21747@rcog.homelinux.net> On the message I sent on March 14, does anyone had the chance to try the modification? Or was it already fixed? (I haven't searched the archive extensively) Or maybe my message got catched by some spam filters? (it made it to the list archive though) Anyway, I would appreciate some feedback (through the list) Thanks From taj at www.linux.org.uk Tue Apr 5 14:42:28 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 21:42:28 +0100 (BST) Subject: [Rxtx] Closing a port from an event listener results in a deadlock In-Reply-To: <20050405175537.GA21747@rcog.homelinux.net> References: <20050405175537.GA21747@rcog.homelinux.net> Message-ID: On Tue, 5 Apr 2005 no_spam at somewhere.com wrote: > On the message I sent on March 14, does anyone had the chance to try the > modification? > > Or was it already fixed? (I haven't searched the archive extensively) > > Or maybe my message got catched by some spam filters? (it made it to the list > archive though) > > Anyway, I would appreciate some feedback (through the list) > The patch is here http://marc.theaimsgroup.com/?l=rxtx&m=111084488820288&w=2 I have applied this patch to a local copy but will not be doing formal testing for a couple weeks. I do not try to close ports from inside the eventListenter usually so I encourage any feedback also. If there are no problems reported, I expect this will go into rxtx 2.1-7. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Wed Apr 6 08:33:42 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Wed, 06 Apr 2005 15:33:42 +0100 Subject: [Rxtx] getting RXTX version Message-ID: <4253F346.50102@emation.pt> Hi, I want to make sure my deployments have the same version of RXTX jar and native lib. I know the version of the jar can be obtained in the Version class, but how can I obtain the native version ? I know RXTX prints to the console a warning if the version is different. Is there a way to programatically know is this is the case ? I would like to log that to our app's log thanks Ricardo From taj at www.linux.org.uk Wed Apr 6 15:10:20 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 6 Apr 2005 22:10:20 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4253F346.50102@emation.pt> References: <4253F346.50102@emation.pt> Message-ID: On Wed, 6 Apr 2005, Ricardo Trindade wrote: > Hi, > > I want to make sure my deployments have the same version of RXTX jar > and native lib. > > I know the version of the jar can be obtained in the Version class, > but how can I obtain the native version ? > > I know RXTX prints to the console a warning if the version is > different. Is there a way to programatically know is this is the case ? > > I would like to log that to our app's log > There isn't a suggested way of doing that right now. We could move things around and have a static String RXTXVersion.getNativeVersion() in future releases. Is this what you expected? This is not documented in commapi at all. I just tossed that in to catch conflicts while developing. It would be nice to have access in GUI applications though. It may be possible to access RXTXCommDriver.LibVersion right now. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Thu Apr 7 02:51:00 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 09:51:00 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> Message-ID: <4254F474.7020905@emation.pt> >There isn't a suggested way of doing that right now. We could move things >around and have a static String RXTXVersion.getNativeVersion() in future >releases. Is this what you expected? > > Yes, that would be perfect. >This is not documented in commapi at all. I just tossed that in to catch >conflicts while developing. It would be nice to have access in GUI >applications though. > >It may be possible to access RXTXCommDriver.LibVersion right now. > > > I tried, and I don't think it's possible. From taj at www.linux.org.uk Thu Apr 7 03:32:04 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 7 Apr 2005 10:32:04 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4254F474.7020905@emation.pt> References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: On Thu, 7 Apr 2005, Ricardo Trindade wrote: > > >There isn't a suggested way of doing that right now. We could move things > >around and have a static String RXTXVersion.getNativeVersion() in future > >releases. Is this what you expected? > > > > > > Yes, that would be perfect. > The attached should do what you want. You will still need to catch an exception for older versions... -- Trent Jarvi taj at www.linux.org.uk -------------- next part -------------- ? public_version.patch Index: RXTXCommDriver.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXCommDriver.java,v retrieving revision 1.16.2.51 diff -u -r1.16.2.51 RXTXCommDriver.java --- RXTXCommDriver.java 12 Oct 2004 09:13:30 -0000 1.16.2.51 +++ RXTXCommDriver.java 7 Apr 2005 09:29:04 -0000 @@ -54,7 +54,7 @@ the Library. */ String JarVersion = RXTXVersion.getVersion(); - String LibVersion = nativeGetVersion(); + String LibVersion = RXTXVersion.nativeGetVersion(); if ( devel ) { System.out.println("Devel Library"); @@ -76,7 +76,6 @@ /** Get the Serial port prefixes for the running OS */ private String deviceDirectory; private String osName; - private static native String nativeGetVersion(); private native boolean registerKnownPorts(int PortType); private native boolean isPortPrefixValid(String dev); private native boolean testRead(String dev, int type); Index: RXTXVersion.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXVersion.java,v retrieving revision 1.2.2.31 diff -u -r1.2.2.31 RXTXVersion.java --- RXTXVersion.java 16 Oct 2004 16:20:35 -0000 1.2.2.31 +++ RXTXVersion.java 7 Apr 2005 09:29:04 -0000 @@ -36,6 +36,7 @@ private static String Version; static { + System.loadLibrary( "rxtxSerial" ); Version = "RXTX-2.1-7pre20"; } /** @@ -47,4 +48,5 @@ { return(Version); } + public static native String nativeGetVersion(); } Index: SerialImp.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v retrieving revision 1.46.2.181 diff -u -r1.46.2.181 SerialImp.c --- SerialImp.c 17 Oct 2004 09:48:56 -0000 1.46.2.181 +++ SerialImp.c 7 Apr 2005 09:29:07 -0000 @@ -116,6 +116,7 @@ * It will eventually be removed. * */ #define RXTXPort(foo) Java_gnu_io_RXTXPort_ ## foo +#define RXTXVersion(foo) Java_gnu_io_RXTXVersion_ ## foo #define RXTXCommDriver(foo) Java_gnu_io_RXTXCommDriver_ ## foo #if defined(__sun__) || defined(__hpux__) @@ -4001,7 +4002,7 @@ } /*---------------------------------------------------------- -RXTXCommDriver.nativeGetVersion +RXTXVersion.nativeGetVersion accept: none perform: return the current version @@ -4010,9 +4011,10 @@ comments: This is used to avoid mixing versions of the .jar and native library. First introduced in rxtx-1.5-9 + Moved from RXTXCommDriver to RXTXVersion in rxtx-2.1-7 ----------------------------------------------------------*/ -JNIEXPORT jstring JNICALL RXTXCommDriver(nativeGetVersion) (JNIEnv *env, +JNIEXPORT jstring JNICALL RXTXVersion(nativeGetVersion) (JNIEnv *env, jclass jclazz ) { return (*env)->NewStringUTF( env, "RXTX-2.1-7pre20" ); From ricardo.trindade at emation.pt Thu Apr 7 03:45:58 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 10:45:58 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: <42550156.2040908@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050407/05212451/attachment-0112.html From thomas.shulok at lmco.com Thu Apr 7 17:43:11 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Thu, 07 Apr 2005 19:43:11 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi There, I'm attempting to talk RS232 between an embedded Linux box and a Windows box. Everything connects up fine, and I can send and receive a simple sequence of bytes with no problems. However, if around 5 seconds goes by without me sending something, I get the following when I attempt to send. java.io.IOException: Input/output error in writeArray Stack trace: java/lang/Throwable.()V java/lang/Throwable.(Ljava/lang/String;)V java/io/IOException.(Ljava/lang/String;)V gnu/io/RXTXPort.writeArray([BIIZ)V gnu/io/RXTXPort$SerialOutputStream.write([B)V SerialTest.main([Ljava/lang/String;)V If there interval is shorter (say 2 seconds between sends), I have no problems. On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and librxtxSerial-2.0.7pre2.so. Any ideas? Thanks, Thom -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5b23dcf/attachment-0112.html From taj at www.linux.org.uk Thu Apr 7 19:22:36 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:22:36 +0100 (BST) Subject: [Rxtx] Input/output error in writeArray In-Reply-To: References: Message-ID: On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a Windows > box. Everything connects up fine, and I can send and receive a simple > sequence of bytes with no problems. However, if around 5 seconds goes > by without me sending something, I get the following when I attempt to > send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Apr 7 19:24:59 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:24:59 +0100 (BST) Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) Message-ID: hmm. This would not work from applets would it? -- Trent Jarvi taj at www.linux.org.uk ---------- Forwarded message ---------- Date: Thu, 07 Apr 2005 16:05:53 -0400 From: Chris Gaffney To: taj at www.linux.org.uk Subject: RXTX Libraries on Classpath fix Hi, I submitted a patch for RXTX a few weeks ago to allow for loading the native libraries from the classpath. Since sending it to you I found it wasn't working on windows. I've fixed the problem and created a new patch that should replace the older one. The actual change is a one line from a String.equals() to a String.startsWith(). Thanks for a great piece of software, -Chris Gaffney Grand Valley State University -------------- next part -------------- A non-text attachment was scrubbed... Name: libraries_on_classpath_fixed.patch Type: text/x-patch Size: 5617 bytes Desc: Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5d423b8/libraries_on_classpath_fixed-0112.bin From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From thomas.shulok at lmco.com Fri Apr 8 10:38:55 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Fri, 08 Apr 2005 12:38:55 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi Trent, Thanks for the prompt response. Before diving deeper, I was wondering if there is a timeout parameter somewhere in the stack that I have not set properly. Given the nature of the failure (only fails if the line has been idle for a few seconds), it feels like some kind of timeout issue... Thanks again, Thom -----Original Message----- From: rxtx-bounces at mail.linuxgrrls.org [mailto:rxtx-bounces at mail.linuxgrrls.org] On Behalf Of Trent Jarvi Sent: Thursday, April 07, 2005 6:23 PM To: Java RXTX discussion Subject: Re: [Rxtx] Input/output error in writeArray On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a > Windows box. Everything connects up fine, and I can send and receive > a simple sequence of bytes with no problems. However, if around 5 > seconds goes by without me sending something, I get the following when > I attempt to send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at mail.linuxgrrls.org http://mail.linuxgrrls.org/mailman/listinfo/rxtx From ricardo.trindade at emation.pt Mon Apr 4 09:17:23 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Mon, 04 Apr 2005 16:17:23 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot Message-ID: <42515A83.4050907@emation.pt> Hi, I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most recent stable snapshot), and get the following exception : It looks like rxtx has been compiled with jdk 1.5. If this was indeed the case, I think there is a compilation flag that generates code that runs on older jdks. java.lang.UnsupportedClassVersionError: gnu/io/UnsupportedCommOperationException (Unsupported major.minor version 49.0) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at java.net.URLClassLoader.defineClass(URLClassLoader.java:251) at java.net.URLClassLoader.access$100(URLClassLoader.java:55) at java.net.URLClassLoader$1.run(URLClassLoader.java:194) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:187) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:141) I'm trying to run it with 1.4. thanks Ricardo From taj at www.linux.org.uk Tue Apr 5 00:48:12 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 07:48:12 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42515A83.4050907@emation.pt> References: <42515A83.4050907@emation.pt> Message-ID: On Mon, 4 Apr 2005, Ricardo Trindade wrote: > Hi, > > I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most > recent stable snapshot), and get the following exception : > > It looks like rxtx has been compiled with jdk 1.5. If this was > indeed the case, I think there is a compilation flag that generates code > that runs on older jdks. > > java.lang.UnsupportedClassVersionError: > gnu/io/UnsupportedCommOperationException (Unsupported major.minor > version 49.0) [snip] Thanks Ricardo I recompiled the jar with javac -source 1.3 -target 1.3. That should cover most of the JRE's in use today. I also compiled the rxtx 2.0 x86_64 native library which appeared to be missing. I tried looking for flags to pass gcc 4.0 to make the native libraries more backwards compatible but only found options for C++ which is not used in rxtx. I've got a list of other bugs that I'll be going through in the next few weeks but for now I just left them with the same CVS filename - no code changes. ftp://ftp.qbang.org/pub/rxtx/rxtx-2.0-CVS-20050120-bins.tar.gz ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-CVS-20050120-bins.tar.gz -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Tue Apr 5 02:24:33 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 05 Apr 2005 09:24:33 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: References: <42515A83.4050907@emation.pt> Message-ID: <42524B41.3040300@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050405/5919abbb/attachment-0113.html From taj at www.linux.org.uk Tue Apr 5 03:00:29 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 10:00:29 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42524B41.3040300@emation.pt> References: <42515A83.4050907@emation.pt> <42524B41.3040300@emation.pt> Message-ID: On Tue, 5 Apr 2005, Ricardo Trindade wrote: > Will you anounce to the list when a new release is available ? > There will be several incremental releases announced here. Once those are done, we will release 2.1.7 and 2.0.7. -- Trent Jarvi taj at www.linux.org.uk From no_spam at somewhere.com Tue Apr 5 11:55:37 2005 From: no_spam at somewhere.com (no_spam@somewhere.com) Date: Tue, 5 Apr 2005 13:55:37 -0400 Subject: [Rxtx] Closing a port from an event listener results in a deadlock Message-ID: <20050405175537.GA21747@rcog.homelinux.net> On the message I sent on March 14, does anyone had the chance to try the modification? Or was it already fixed? (I haven't searched the archive extensively) Or maybe my message got catched by some spam filters? (it made it to the list archive though) Anyway, I would appreciate some feedback (through the list) Thanks From taj at www.linux.org.uk Tue Apr 5 14:42:28 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 21:42:28 +0100 (BST) Subject: [Rxtx] Closing a port from an event listener results in a deadlock In-Reply-To: <20050405175537.GA21747@rcog.homelinux.net> References: <20050405175537.GA21747@rcog.homelinux.net> Message-ID: On Tue, 5 Apr 2005 no_spam at somewhere.com wrote: > On the message I sent on March 14, does anyone had the chance to try the > modification? > > Or was it already fixed? (I haven't searched the archive extensively) > > Or maybe my message got catched by some spam filters? (it made it to the list > archive though) > > Anyway, I would appreciate some feedback (through the list) > The patch is here http://marc.theaimsgroup.com/?l=rxtx&m=111084488820288&w=2 I have applied this patch to a local copy but will not be doing formal testing for a couple weeks. I do not try to close ports from inside the eventListenter usually so I encourage any feedback also. If there are no problems reported, I expect this will go into rxtx 2.1-7. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Wed Apr 6 08:33:42 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Wed, 06 Apr 2005 15:33:42 +0100 Subject: [Rxtx] getting RXTX version Message-ID: <4253F346.50102@emation.pt> Hi, I want to make sure my deployments have the same version of RXTX jar and native lib. I know the version of the jar can be obtained in the Version class, but how can I obtain the native version ? I know RXTX prints to the console a warning if the version is different. Is there a way to programatically know is this is the case ? I would like to log that to our app's log thanks Ricardo From taj at www.linux.org.uk Wed Apr 6 15:10:20 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 6 Apr 2005 22:10:20 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4253F346.50102@emation.pt> References: <4253F346.50102@emation.pt> Message-ID: On Wed, 6 Apr 2005, Ricardo Trindade wrote: > Hi, > > I want to make sure my deployments have the same version of RXTX jar > and native lib. > > I know the version of the jar can be obtained in the Version class, > but how can I obtain the native version ? > > I know RXTX prints to the console a warning if the version is > different. Is there a way to programatically know is this is the case ? > > I would like to log that to our app's log > There isn't a suggested way of doing that right now. We could move things around and have a static String RXTXVersion.getNativeVersion() in future releases. Is this what you expected? This is not documented in commapi at all. I just tossed that in to catch conflicts while developing. It would be nice to have access in GUI applications though. It may be possible to access RXTXCommDriver.LibVersion right now. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Thu Apr 7 02:51:00 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 09:51:00 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> Message-ID: <4254F474.7020905@emation.pt> >There isn't a suggested way of doing that right now. We could move things >around and have a static String RXTXVersion.getNativeVersion() in future >releases. Is this what you expected? > > Yes, that would be perfect. >This is not documented in commapi at all. I just tossed that in to catch >conflicts while developing. It would be nice to have access in GUI >applications though. > >It may be possible to access RXTXCommDriver.LibVersion right now. > > > I tried, and I don't think it's possible. From taj at www.linux.org.uk Thu Apr 7 03:32:04 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 7 Apr 2005 10:32:04 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4254F474.7020905@emation.pt> References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: On Thu, 7 Apr 2005, Ricardo Trindade wrote: > > >There isn't a suggested way of doing that right now. We could move things > >around and have a static String RXTXVersion.getNativeVersion() in future > >releases. Is this what you expected? > > > > > > Yes, that would be perfect. > The attached should do what you want. You will still need to catch an exception for older versions... -- Trent Jarvi taj at www.linux.org.uk -------------- next part -------------- ? public_version.patch Index: RXTXCommDriver.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXCommDriver.java,v retrieving revision 1.16.2.51 diff -u -r1.16.2.51 RXTXCommDriver.java --- RXTXCommDriver.java 12 Oct 2004 09:13:30 -0000 1.16.2.51 +++ RXTXCommDriver.java 7 Apr 2005 09:29:04 -0000 @@ -54,7 +54,7 @@ the Library. */ String JarVersion = RXTXVersion.getVersion(); - String LibVersion = nativeGetVersion(); + String LibVersion = RXTXVersion.nativeGetVersion(); if ( devel ) { System.out.println("Devel Library"); @@ -76,7 +76,6 @@ /** Get the Serial port prefixes for the running OS */ private String deviceDirectory; private String osName; - private static native String nativeGetVersion(); private native boolean registerKnownPorts(int PortType); private native boolean isPortPrefixValid(String dev); private native boolean testRead(String dev, int type); Index: RXTXVersion.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXVersion.java,v retrieving revision 1.2.2.31 diff -u -r1.2.2.31 RXTXVersion.java --- RXTXVersion.java 16 Oct 2004 16:20:35 -0000 1.2.2.31 +++ RXTXVersion.java 7 Apr 2005 09:29:04 -0000 @@ -36,6 +36,7 @@ private static String Version; static { + System.loadLibrary( "rxtxSerial" ); Version = "RXTX-2.1-7pre20"; } /** @@ -47,4 +48,5 @@ { return(Version); } + public static native String nativeGetVersion(); } Index: SerialImp.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v retrieving revision 1.46.2.181 diff -u -r1.46.2.181 SerialImp.c --- SerialImp.c 17 Oct 2004 09:48:56 -0000 1.46.2.181 +++ SerialImp.c 7 Apr 2005 09:29:07 -0000 @@ -116,6 +116,7 @@ * It will eventually be removed. * */ #define RXTXPort(foo) Java_gnu_io_RXTXPort_ ## foo +#define RXTXVersion(foo) Java_gnu_io_RXTXVersion_ ## foo #define RXTXCommDriver(foo) Java_gnu_io_RXTXCommDriver_ ## foo #if defined(__sun__) || defined(__hpux__) @@ -4001,7 +4002,7 @@ } /*---------------------------------------------------------- -RXTXCommDriver.nativeGetVersion +RXTXVersion.nativeGetVersion accept: none perform: return the current version @@ -4010,9 +4011,10 @@ comments: This is used to avoid mixing versions of the .jar and native library. First introduced in rxtx-1.5-9 + Moved from RXTXCommDriver to RXTXVersion in rxtx-2.1-7 ----------------------------------------------------------*/ -JNIEXPORT jstring JNICALL RXTXCommDriver(nativeGetVersion) (JNIEnv *env, +JNIEXPORT jstring JNICALL RXTXVersion(nativeGetVersion) (JNIEnv *env, jclass jclazz ) { return (*env)->NewStringUTF( env, "RXTX-2.1-7pre20" ); From ricardo.trindade at emation.pt Thu Apr 7 03:45:58 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 10:45:58 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: <42550156.2040908@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050407/05212451/attachment-0113.html From thomas.shulok at lmco.com Thu Apr 7 17:43:11 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Thu, 07 Apr 2005 19:43:11 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi There, I'm attempting to talk RS232 between an embedded Linux box and a Windows box. Everything connects up fine, and I can send and receive a simple sequence of bytes with no problems. However, if around 5 seconds goes by without me sending something, I get the following when I attempt to send. java.io.IOException: Input/output error in writeArray Stack trace: java/lang/Throwable.()V java/lang/Throwable.(Ljava/lang/String;)V java/io/IOException.(Ljava/lang/String;)V gnu/io/RXTXPort.writeArray([BIIZ)V gnu/io/RXTXPort$SerialOutputStream.write([B)V SerialTest.main([Ljava/lang/String;)V If there interval is shorter (say 2 seconds between sends), I have no problems. On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and librxtxSerial-2.0.7pre2.so. Any ideas? Thanks, Thom -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5b23dcf/attachment-0113.html From taj at www.linux.org.uk Thu Apr 7 19:22:36 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:22:36 +0100 (BST) Subject: [Rxtx] Input/output error in writeArray In-Reply-To: References: Message-ID: On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a Windows > box. Everything connects up fine, and I can send and receive a simple > sequence of bytes with no problems. However, if around 5 seconds goes > by without me sending something, I get the following when I attempt to > send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Apr 7 19:24:59 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:24:59 +0100 (BST) Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) Message-ID: hmm. This would not work from applets would it? -- Trent Jarvi taj at www.linux.org.uk ---------- Forwarded message ---------- Date: Thu, 07 Apr 2005 16:05:53 -0400 From: Chris Gaffney To: taj at www.linux.org.uk Subject: RXTX Libraries on Classpath fix Hi, I submitted a patch for RXTX a few weeks ago to allow for loading the native libraries from the classpath. Since sending it to you I found it wasn't working on windows. I've fixed the problem and created a new patch that should replace the older one. The actual change is a one line from a String.equals() to a String.startsWith(). Thanks for a great piece of software, -Chris Gaffney Grand Valley State University -------------- next part -------------- A non-text attachment was scrubbed... Name: libraries_on_classpath_fixed.patch Type: text/x-patch Size: 5617 bytes Desc: Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5d423b8/libraries_on_classpath_fixed-0113.bin From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From thomas.shulok at lmco.com Fri Apr 8 10:38:55 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Fri, 08 Apr 2005 12:38:55 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi Trent, Thanks for the prompt response. Before diving deeper, I was wondering if there is a timeout parameter somewhere in the stack that I have not set properly. Given the nature of the failure (only fails if the line has been idle for a few seconds), it feels like some kind of timeout issue... Thanks again, Thom -----Original Message----- From: rxtx-bounces at mail.linuxgrrls.org [mailto:rxtx-bounces at mail.linuxgrrls.org] On Behalf Of Trent Jarvi Sent: Thursday, April 07, 2005 6:23 PM To: Java RXTX discussion Subject: Re: [Rxtx] Input/output error in writeArray On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a > Windows box. Everything connects up fine, and I can send and receive > a simple sequence of bytes with no problems. However, if around 5 > seconds goes by without me sending something, I get the following when > I attempt to send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at mail.linuxgrrls.org http://mail.linuxgrrls.org/mailman/listinfo/rxtx From ricardo.trindade at emation.pt Mon Apr 4 09:17:23 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Mon, 04 Apr 2005 16:17:23 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot Message-ID: <42515A83.4050907@emation.pt> Hi, I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most recent stable snapshot), and get the following exception : It looks like rxtx has been compiled with jdk 1.5. If this was indeed the case, I think there is a compilation flag that generates code that runs on older jdks. java.lang.UnsupportedClassVersionError: gnu/io/UnsupportedCommOperationException (Unsupported major.minor version 49.0) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at java.net.URLClassLoader.defineClass(URLClassLoader.java:251) at java.net.URLClassLoader.access$100(URLClassLoader.java:55) at java.net.URLClassLoader$1.run(URLClassLoader.java:194) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:187) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:141) I'm trying to run it with 1.4. thanks Ricardo From taj at www.linux.org.uk Tue Apr 5 00:48:12 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 07:48:12 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42515A83.4050907@emation.pt> References: <42515A83.4050907@emation.pt> Message-ID: On Mon, 4 Apr 2005, Ricardo Trindade wrote: > Hi, > > I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most > recent stable snapshot), and get the following exception : > > It looks like rxtx has been compiled with jdk 1.5. If this was > indeed the case, I think there is a compilation flag that generates code > that runs on older jdks. > > java.lang.UnsupportedClassVersionError: > gnu/io/UnsupportedCommOperationException (Unsupported major.minor > version 49.0) [snip] Thanks Ricardo I recompiled the jar with javac -source 1.3 -target 1.3. That should cover most of the JRE's in use today. I also compiled the rxtx 2.0 x86_64 native library which appeared to be missing. I tried looking for flags to pass gcc 4.0 to make the native libraries more backwards compatible but only found options for C++ which is not used in rxtx. I've got a list of other bugs that I'll be going through in the next few weeks but for now I just left them with the same CVS filename - no code changes. ftp://ftp.qbang.org/pub/rxtx/rxtx-2.0-CVS-20050120-bins.tar.gz ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-CVS-20050120-bins.tar.gz -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Tue Apr 5 02:24:33 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 05 Apr 2005 09:24:33 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: References: <42515A83.4050907@emation.pt> Message-ID: <42524B41.3040300@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050405/5919abbb/attachment-0114.html From taj at www.linux.org.uk Tue Apr 5 03:00:29 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 10:00:29 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42524B41.3040300@emation.pt> References: <42515A83.4050907@emation.pt> <42524B41.3040300@emation.pt> Message-ID: On Tue, 5 Apr 2005, Ricardo Trindade wrote: > Will you anounce to the list when a new release is available ? > There will be several incremental releases announced here. Once those are done, we will release 2.1.7 and 2.0.7. -- Trent Jarvi taj at www.linux.org.uk From no_spam at somewhere.com Tue Apr 5 11:55:37 2005 From: no_spam at somewhere.com (no_spam@somewhere.com) Date: Tue, 5 Apr 2005 13:55:37 -0400 Subject: [Rxtx] Closing a port from an event listener results in a deadlock Message-ID: <20050405175537.GA21747@rcog.homelinux.net> On the message I sent on March 14, does anyone had the chance to try the modification? Or was it already fixed? (I haven't searched the archive extensively) Or maybe my message got catched by some spam filters? (it made it to the list archive though) Anyway, I would appreciate some feedback (through the list) Thanks From taj at www.linux.org.uk Tue Apr 5 14:42:28 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 21:42:28 +0100 (BST) Subject: [Rxtx] Closing a port from an event listener results in a deadlock In-Reply-To: <20050405175537.GA21747@rcog.homelinux.net> References: <20050405175537.GA21747@rcog.homelinux.net> Message-ID: On Tue, 5 Apr 2005 no_spam at somewhere.com wrote: > On the message I sent on March 14, does anyone had the chance to try the > modification? > > Or was it already fixed? (I haven't searched the archive extensively) > > Or maybe my message got catched by some spam filters? (it made it to the list > archive though) > > Anyway, I would appreciate some feedback (through the list) > The patch is here http://marc.theaimsgroup.com/?l=rxtx&m=111084488820288&w=2 I have applied this patch to a local copy but will not be doing formal testing for a couple weeks. I do not try to close ports from inside the eventListenter usually so I encourage any feedback also. If there are no problems reported, I expect this will go into rxtx 2.1-7. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Wed Apr 6 08:33:42 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Wed, 06 Apr 2005 15:33:42 +0100 Subject: [Rxtx] getting RXTX version Message-ID: <4253F346.50102@emation.pt> Hi, I want to make sure my deployments have the same version of RXTX jar and native lib. I know the version of the jar can be obtained in the Version class, but how can I obtain the native version ? I know RXTX prints to the console a warning if the version is different. Is there a way to programatically know is this is the case ? I would like to log that to our app's log thanks Ricardo From taj at www.linux.org.uk Wed Apr 6 15:10:20 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 6 Apr 2005 22:10:20 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4253F346.50102@emation.pt> References: <4253F346.50102@emation.pt> Message-ID: On Wed, 6 Apr 2005, Ricardo Trindade wrote: > Hi, > > I want to make sure my deployments have the same version of RXTX jar > and native lib. > > I know the version of the jar can be obtained in the Version class, > but how can I obtain the native version ? > > I know RXTX prints to the console a warning if the version is > different. Is there a way to programatically know is this is the case ? > > I would like to log that to our app's log > There isn't a suggested way of doing that right now. We could move things around and have a static String RXTXVersion.getNativeVersion() in future releases. Is this what you expected? This is not documented in commapi at all. I just tossed that in to catch conflicts while developing. It would be nice to have access in GUI applications though. It may be possible to access RXTXCommDriver.LibVersion right now. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Thu Apr 7 02:51:00 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 09:51:00 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> Message-ID: <4254F474.7020905@emation.pt> >There isn't a suggested way of doing that right now. We could move things >around and have a static String RXTXVersion.getNativeVersion() in future >releases. Is this what you expected? > > Yes, that would be perfect. >This is not documented in commapi at all. I just tossed that in to catch >conflicts while developing. It would be nice to have access in GUI >applications though. > >It may be possible to access RXTXCommDriver.LibVersion right now. > > > I tried, and I don't think it's possible. From taj at www.linux.org.uk Thu Apr 7 03:32:04 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 7 Apr 2005 10:32:04 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4254F474.7020905@emation.pt> References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: On Thu, 7 Apr 2005, Ricardo Trindade wrote: > > >There isn't a suggested way of doing that right now. We could move things > >around and have a static String RXTXVersion.getNativeVersion() in future > >releases. Is this what you expected? > > > > > > Yes, that would be perfect. > The attached should do what you want. You will still need to catch an exception for older versions... -- Trent Jarvi taj at www.linux.org.uk -------------- next part -------------- ? public_version.patch Index: RXTXCommDriver.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXCommDriver.java,v retrieving revision 1.16.2.51 diff -u -r1.16.2.51 RXTXCommDriver.java --- RXTXCommDriver.java 12 Oct 2004 09:13:30 -0000 1.16.2.51 +++ RXTXCommDriver.java 7 Apr 2005 09:29:04 -0000 @@ -54,7 +54,7 @@ the Library. */ String JarVersion = RXTXVersion.getVersion(); - String LibVersion = nativeGetVersion(); + String LibVersion = RXTXVersion.nativeGetVersion(); if ( devel ) { System.out.println("Devel Library"); @@ -76,7 +76,6 @@ /** Get the Serial port prefixes for the running OS */ private String deviceDirectory; private String osName; - private static native String nativeGetVersion(); private native boolean registerKnownPorts(int PortType); private native boolean isPortPrefixValid(String dev); private native boolean testRead(String dev, int type); Index: RXTXVersion.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXVersion.java,v retrieving revision 1.2.2.31 diff -u -r1.2.2.31 RXTXVersion.java --- RXTXVersion.java 16 Oct 2004 16:20:35 -0000 1.2.2.31 +++ RXTXVersion.java 7 Apr 2005 09:29:04 -0000 @@ -36,6 +36,7 @@ private static String Version; static { + System.loadLibrary( "rxtxSerial" ); Version = "RXTX-2.1-7pre20"; } /** @@ -47,4 +48,5 @@ { return(Version); } + public static native String nativeGetVersion(); } Index: SerialImp.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v retrieving revision 1.46.2.181 diff -u -r1.46.2.181 SerialImp.c --- SerialImp.c 17 Oct 2004 09:48:56 -0000 1.46.2.181 +++ SerialImp.c 7 Apr 2005 09:29:07 -0000 @@ -116,6 +116,7 @@ * It will eventually be removed. * */ #define RXTXPort(foo) Java_gnu_io_RXTXPort_ ## foo +#define RXTXVersion(foo) Java_gnu_io_RXTXVersion_ ## foo #define RXTXCommDriver(foo) Java_gnu_io_RXTXCommDriver_ ## foo #if defined(__sun__) || defined(__hpux__) @@ -4001,7 +4002,7 @@ } /*---------------------------------------------------------- -RXTXCommDriver.nativeGetVersion +RXTXVersion.nativeGetVersion accept: none perform: return the current version @@ -4010,9 +4011,10 @@ comments: This is used to avoid mixing versions of the .jar and native library. First introduced in rxtx-1.5-9 + Moved from RXTXCommDriver to RXTXVersion in rxtx-2.1-7 ----------------------------------------------------------*/ -JNIEXPORT jstring JNICALL RXTXCommDriver(nativeGetVersion) (JNIEnv *env, +JNIEXPORT jstring JNICALL RXTXVersion(nativeGetVersion) (JNIEnv *env, jclass jclazz ) { return (*env)->NewStringUTF( env, "RXTX-2.1-7pre20" ); From ricardo.trindade at emation.pt Thu Apr 7 03:45:58 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 10:45:58 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: <42550156.2040908@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050407/05212451/attachment-0114.html From thomas.shulok at lmco.com Thu Apr 7 17:43:11 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Thu, 07 Apr 2005 19:43:11 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi There, I'm attempting to talk RS232 between an embedded Linux box and a Windows box. Everything connects up fine, and I can send and receive a simple sequence of bytes with no problems. However, if around 5 seconds goes by without me sending something, I get the following when I attempt to send. java.io.IOException: Input/output error in writeArray Stack trace: java/lang/Throwable.()V java/lang/Throwable.(Ljava/lang/String;)V java/io/IOException.(Ljava/lang/String;)V gnu/io/RXTXPort.writeArray([BIIZ)V gnu/io/RXTXPort$SerialOutputStream.write([B)V SerialTest.main([Ljava/lang/String;)V If there interval is shorter (say 2 seconds between sends), I have no problems. On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and librxtxSerial-2.0.7pre2.so. Any ideas? Thanks, Thom -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5b23dcf/attachment-0114.html From taj at www.linux.org.uk Thu Apr 7 19:22:36 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:22:36 +0100 (BST) Subject: [Rxtx] Input/output error in writeArray In-Reply-To: References: Message-ID: On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a Windows > box. Everything connects up fine, and I can send and receive a simple > sequence of bytes with no problems. However, if around 5 seconds goes > by without me sending something, I get the following when I attempt to > send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Apr 7 19:24:59 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:24:59 +0100 (BST) Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) Message-ID: hmm. This would not work from applets would it? -- Trent Jarvi taj at www.linux.org.uk ---------- Forwarded message ---------- Date: Thu, 07 Apr 2005 16:05:53 -0400 From: Chris Gaffney To: taj at www.linux.org.uk Subject: RXTX Libraries on Classpath fix Hi, I submitted a patch for RXTX a few weeks ago to allow for loading the native libraries from the classpath. Since sending it to you I found it wasn't working on windows. I've fixed the problem and created a new patch that should replace the older one. The actual change is a one line from a String.equals() to a String.startsWith(). Thanks for a great piece of software, -Chris Gaffney Grand Valley State University -------------- next part -------------- A non-text attachment was scrubbed... Name: libraries_on_classpath_fixed.patch Type: text/x-patch Size: 5617 bytes Desc: Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5d423b8/libraries_on_classpath_fixed-0114.bin From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From thomas.shulok at lmco.com Fri Apr 8 10:38:55 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Fri, 08 Apr 2005 12:38:55 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi Trent, Thanks for the prompt response. Before diving deeper, I was wondering if there is a timeout parameter somewhere in the stack that I have not set properly. Given the nature of the failure (only fails if the line has been idle for a few seconds), it feels like some kind of timeout issue... Thanks again, Thom -----Original Message----- From: rxtx-bounces at mail.linuxgrrls.org [mailto:rxtx-bounces at mail.linuxgrrls.org] On Behalf Of Trent Jarvi Sent: Thursday, April 07, 2005 6:23 PM To: Java RXTX discussion Subject: Re: [Rxtx] Input/output error in writeArray On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a > Windows box. Everything connects up fine, and I can send and receive > a simple sequence of bytes with no problems. However, if around 5 > seconds goes by without me sending something, I get the following when > I attempt to send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at mail.linuxgrrls.org http://mail.linuxgrrls.org/mailman/listinfo/rxtx From ricardo.trindade at emation.pt Mon Apr 4 09:17:23 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Mon, 04 Apr 2005 16:17:23 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot Message-ID: <42515A83.4050907@emation.pt> Hi, I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most recent stable snapshot), and get the following exception : It looks like rxtx has been compiled with jdk 1.5. If this was indeed the case, I think there is a compilation flag that generates code that runs on older jdks. java.lang.UnsupportedClassVersionError: gnu/io/UnsupportedCommOperationException (Unsupported major.minor version 49.0) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at java.net.URLClassLoader.defineClass(URLClassLoader.java:251) at java.net.URLClassLoader.access$100(URLClassLoader.java:55) at java.net.URLClassLoader$1.run(URLClassLoader.java:194) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:187) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:141) I'm trying to run it with 1.4. thanks Ricardo From taj at www.linux.org.uk Tue Apr 5 00:48:12 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 07:48:12 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42515A83.4050907@emation.pt> References: <42515A83.4050907@emation.pt> Message-ID: On Mon, 4 Apr 2005, Ricardo Trindade wrote: > Hi, > > I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most > recent stable snapshot), and get the following exception : > > It looks like rxtx has been compiled with jdk 1.5. If this was > indeed the case, I think there is a compilation flag that generates code > that runs on older jdks. > > java.lang.UnsupportedClassVersionError: > gnu/io/UnsupportedCommOperationException (Unsupported major.minor > version 49.0) [snip] Thanks Ricardo I recompiled the jar with javac -source 1.3 -target 1.3. That should cover most of the JRE's in use today. I also compiled the rxtx 2.0 x86_64 native library which appeared to be missing. I tried looking for flags to pass gcc 4.0 to make the native libraries more backwards compatible but only found options for C++ which is not used in rxtx. I've got a list of other bugs that I'll be going through in the next few weeks but for now I just left them with the same CVS filename - no code changes. ftp://ftp.qbang.org/pub/rxtx/rxtx-2.0-CVS-20050120-bins.tar.gz ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-CVS-20050120-bins.tar.gz -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Tue Apr 5 02:24:33 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 05 Apr 2005 09:24:33 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: References: <42515A83.4050907@emation.pt> Message-ID: <42524B41.3040300@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050405/5919abbb/attachment-0115.html From taj at www.linux.org.uk Tue Apr 5 03:00:29 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 10:00:29 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42524B41.3040300@emation.pt> References: <42515A83.4050907@emation.pt> <42524B41.3040300@emation.pt> Message-ID: On Tue, 5 Apr 2005, Ricardo Trindade wrote: > Will you anounce to the list when a new release is available ? > There will be several incremental releases announced here. Once those are done, we will release 2.1.7 and 2.0.7. -- Trent Jarvi taj at www.linux.org.uk From no_spam at somewhere.com Tue Apr 5 11:55:37 2005 From: no_spam at somewhere.com (no_spam@somewhere.com) Date: Tue, 5 Apr 2005 13:55:37 -0400 Subject: [Rxtx] Closing a port from an event listener results in a deadlock Message-ID: <20050405175537.GA21747@rcog.homelinux.net> On the message I sent on March 14, does anyone had the chance to try the modification? Or was it already fixed? (I haven't searched the archive extensively) Or maybe my message got catched by some spam filters? (it made it to the list archive though) Anyway, I would appreciate some feedback (through the list) Thanks From taj at www.linux.org.uk Tue Apr 5 14:42:28 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 21:42:28 +0100 (BST) Subject: [Rxtx] Closing a port from an event listener results in a deadlock In-Reply-To: <20050405175537.GA21747@rcog.homelinux.net> References: <20050405175537.GA21747@rcog.homelinux.net> Message-ID: On Tue, 5 Apr 2005 no_spam at somewhere.com wrote: > On the message I sent on March 14, does anyone had the chance to try the > modification? > > Or was it already fixed? (I haven't searched the archive extensively) > > Or maybe my message got catched by some spam filters? (it made it to the list > archive though) > > Anyway, I would appreciate some feedback (through the list) > The patch is here http://marc.theaimsgroup.com/?l=rxtx&m=111084488820288&w=2 I have applied this patch to a local copy but will not be doing formal testing for a couple weeks. I do not try to close ports from inside the eventListenter usually so I encourage any feedback also. If there are no problems reported, I expect this will go into rxtx 2.1-7. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Wed Apr 6 08:33:42 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Wed, 06 Apr 2005 15:33:42 +0100 Subject: [Rxtx] getting RXTX version Message-ID: <4253F346.50102@emation.pt> Hi, I want to make sure my deployments have the same version of RXTX jar and native lib. I know the version of the jar can be obtained in the Version class, but how can I obtain the native version ? I know RXTX prints to the console a warning if the version is different. Is there a way to programatically know is this is the case ? I would like to log that to our app's log thanks Ricardo From taj at www.linux.org.uk Wed Apr 6 15:10:20 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 6 Apr 2005 22:10:20 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4253F346.50102@emation.pt> References: <4253F346.50102@emation.pt> Message-ID: On Wed, 6 Apr 2005, Ricardo Trindade wrote: > Hi, > > I want to make sure my deployments have the same version of RXTX jar > and native lib. > > I know the version of the jar can be obtained in the Version class, > but how can I obtain the native version ? > > I know RXTX prints to the console a warning if the version is > different. Is there a way to programatically know is this is the case ? > > I would like to log that to our app's log > There isn't a suggested way of doing that right now. We could move things around and have a static String RXTXVersion.getNativeVersion() in future releases. Is this what you expected? This is not documented in commapi at all. I just tossed that in to catch conflicts while developing. It would be nice to have access in GUI applications though. It may be possible to access RXTXCommDriver.LibVersion right now. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Thu Apr 7 02:51:00 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 09:51:00 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> Message-ID: <4254F474.7020905@emation.pt> >There isn't a suggested way of doing that right now. We could move things >around and have a static String RXTXVersion.getNativeVersion() in future >releases. Is this what you expected? > > Yes, that would be perfect. >This is not documented in commapi at all. I just tossed that in to catch >conflicts while developing. It would be nice to have access in GUI >applications though. > >It may be possible to access RXTXCommDriver.LibVersion right now. > > > I tried, and I don't think it's possible. From taj at www.linux.org.uk Thu Apr 7 03:32:04 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 7 Apr 2005 10:32:04 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4254F474.7020905@emation.pt> References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: On Thu, 7 Apr 2005, Ricardo Trindade wrote: > > >There isn't a suggested way of doing that right now. We could move things > >around and have a static String RXTXVersion.getNativeVersion() in future > >releases. Is this what you expected? > > > > > > Yes, that would be perfect. > The attached should do what you want. You will still need to catch an exception for older versions... -- Trent Jarvi taj at www.linux.org.uk -------------- next part -------------- ? public_version.patch Index: RXTXCommDriver.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXCommDriver.java,v retrieving revision 1.16.2.51 diff -u -r1.16.2.51 RXTXCommDriver.java --- RXTXCommDriver.java 12 Oct 2004 09:13:30 -0000 1.16.2.51 +++ RXTXCommDriver.java 7 Apr 2005 09:29:04 -0000 @@ -54,7 +54,7 @@ the Library. */ String JarVersion = RXTXVersion.getVersion(); - String LibVersion = nativeGetVersion(); + String LibVersion = RXTXVersion.nativeGetVersion(); if ( devel ) { System.out.println("Devel Library"); @@ -76,7 +76,6 @@ /** Get the Serial port prefixes for the running OS */ private String deviceDirectory; private String osName; - private static native String nativeGetVersion(); private native boolean registerKnownPorts(int PortType); private native boolean isPortPrefixValid(String dev); private native boolean testRead(String dev, int type); Index: RXTXVersion.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXVersion.java,v retrieving revision 1.2.2.31 diff -u -r1.2.2.31 RXTXVersion.java --- RXTXVersion.java 16 Oct 2004 16:20:35 -0000 1.2.2.31 +++ RXTXVersion.java 7 Apr 2005 09:29:04 -0000 @@ -36,6 +36,7 @@ private static String Version; static { + System.loadLibrary( "rxtxSerial" ); Version = "RXTX-2.1-7pre20"; } /** @@ -47,4 +48,5 @@ { return(Version); } + public static native String nativeGetVersion(); } Index: SerialImp.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v retrieving revision 1.46.2.181 diff -u -r1.46.2.181 SerialImp.c --- SerialImp.c 17 Oct 2004 09:48:56 -0000 1.46.2.181 +++ SerialImp.c 7 Apr 2005 09:29:07 -0000 @@ -116,6 +116,7 @@ * It will eventually be removed. * */ #define RXTXPort(foo) Java_gnu_io_RXTXPort_ ## foo +#define RXTXVersion(foo) Java_gnu_io_RXTXVersion_ ## foo #define RXTXCommDriver(foo) Java_gnu_io_RXTXCommDriver_ ## foo #if defined(__sun__) || defined(__hpux__) @@ -4001,7 +4002,7 @@ } /*---------------------------------------------------------- -RXTXCommDriver.nativeGetVersion +RXTXVersion.nativeGetVersion accept: none perform: return the current version @@ -4010,9 +4011,10 @@ comments: This is used to avoid mixing versions of the .jar and native library. First introduced in rxtx-1.5-9 + Moved from RXTXCommDriver to RXTXVersion in rxtx-2.1-7 ----------------------------------------------------------*/ -JNIEXPORT jstring JNICALL RXTXCommDriver(nativeGetVersion) (JNIEnv *env, +JNIEXPORT jstring JNICALL RXTXVersion(nativeGetVersion) (JNIEnv *env, jclass jclazz ) { return (*env)->NewStringUTF( env, "RXTX-2.1-7pre20" ); From ricardo.trindade at emation.pt Thu Apr 7 03:45:58 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 10:45:58 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: <42550156.2040908@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050407/05212451/attachment-0115.html From thomas.shulok at lmco.com Thu Apr 7 17:43:11 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Thu, 07 Apr 2005 19:43:11 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi There, I'm attempting to talk RS232 between an embedded Linux box and a Windows box. Everything connects up fine, and I can send and receive a simple sequence of bytes with no problems. However, if around 5 seconds goes by without me sending something, I get the following when I attempt to send. java.io.IOException: Input/output error in writeArray Stack trace: java/lang/Throwable.()V java/lang/Throwable.(Ljava/lang/String;)V java/io/IOException.(Ljava/lang/String;)V gnu/io/RXTXPort.writeArray([BIIZ)V gnu/io/RXTXPort$SerialOutputStream.write([B)V SerialTest.main([Ljava/lang/String;)V If there interval is shorter (say 2 seconds between sends), I have no problems. On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and librxtxSerial-2.0.7pre2.so. Any ideas? Thanks, Thom -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5b23dcf/attachment-0115.html From taj at www.linux.org.uk Thu Apr 7 19:22:36 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:22:36 +0100 (BST) Subject: [Rxtx] Input/output error in writeArray In-Reply-To: References: Message-ID: On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a Windows > box. Everything connects up fine, and I can send and receive a simple > sequence of bytes with no problems. However, if around 5 seconds goes > by without me sending something, I get the following when I attempt to > send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Apr 7 19:24:59 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:24:59 +0100 (BST) Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) Message-ID: hmm. This would not work from applets would it? -- Trent Jarvi taj at www.linux.org.uk ---------- Forwarded message ---------- Date: Thu, 07 Apr 2005 16:05:53 -0400 From: Chris Gaffney To: taj at www.linux.org.uk Subject: RXTX Libraries on Classpath fix Hi, I submitted a patch for RXTX a few weeks ago to allow for loading the native libraries from the classpath. Since sending it to you I found it wasn't working on windows. I've fixed the problem and created a new patch that should replace the older one. The actual change is a one line from a String.equals() to a String.startsWith(). Thanks for a great piece of software, -Chris Gaffney Grand Valley State University -------------- next part -------------- A non-text attachment was scrubbed... Name: libraries_on_classpath_fixed.patch Type: text/x-patch Size: 5617 bytes Desc: Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5d423b8/libraries_on_classpath_fixed-0115.bin From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From thomas.shulok at lmco.com Fri Apr 8 10:38:55 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Fri, 08 Apr 2005 12:38:55 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi Trent, Thanks for the prompt response. Before diving deeper, I was wondering if there is a timeout parameter somewhere in the stack that I have not set properly. Given the nature of the failure (only fails if the line has been idle for a few seconds), it feels like some kind of timeout issue... Thanks again, Thom -----Original Message----- From: rxtx-bounces at mail.linuxgrrls.org [mailto:rxtx-bounces at mail.linuxgrrls.org] On Behalf Of Trent Jarvi Sent: Thursday, April 07, 2005 6:23 PM To: Java RXTX discussion Subject: Re: [Rxtx] Input/output error in writeArray On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a > Windows box. Everything connects up fine, and I can send and receive > a simple sequence of bytes with no problems. However, if around 5 > seconds goes by without me sending something, I get the following when > I attempt to send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at mail.linuxgrrls.org http://mail.linuxgrrls.org/mailman/listinfo/rxtx From ricardo.trindade at emation.pt Mon Apr 4 09:17:23 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Mon, 04 Apr 2005 16:17:23 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot Message-ID: <42515A83.4050907@emation.pt> Hi, I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most recent stable snapshot), and get the following exception : It looks like rxtx has been compiled with jdk 1.5. If this was indeed the case, I think there is a compilation flag that generates code that runs on older jdks. java.lang.UnsupportedClassVersionError: gnu/io/UnsupportedCommOperationException (Unsupported major.minor version 49.0) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at java.net.URLClassLoader.defineClass(URLClassLoader.java:251) at java.net.URLClassLoader.access$100(URLClassLoader.java:55) at java.net.URLClassLoader$1.run(URLClassLoader.java:194) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:187) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:141) I'm trying to run it with 1.4. thanks Ricardo From taj at www.linux.org.uk Tue Apr 5 00:48:12 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 07:48:12 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42515A83.4050907@emation.pt> References: <42515A83.4050907@emation.pt> Message-ID: On Mon, 4 Apr 2005, Ricardo Trindade wrote: > Hi, > > I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most > recent stable snapshot), and get the following exception : > > It looks like rxtx has been compiled with jdk 1.5. If this was > indeed the case, I think there is a compilation flag that generates code > that runs on older jdks. > > java.lang.UnsupportedClassVersionError: > gnu/io/UnsupportedCommOperationException (Unsupported major.minor > version 49.0) [snip] Thanks Ricardo I recompiled the jar with javac -source 1.3 -target 1.3. That should cover most of the JRE's in use today. I also compiled the rxtx 2.0 x86_64 native library which appeared to be missing. I tried looking for flags to pass gcc 4.0 to make the native libraries more backwards compatible but only found options for C++ which is not used in rxtx. I've got a list of other bugs that I'll be going through in the next few weeks but for now I just left them with the same CVS filename - no code changes. ftp://ftp.qbang.org/pub/rxtx/rxtx-2.0-CVS-20050120-bins.tar.gz ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-CVS-20050120-bins.tar.gz -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Tue Apr 5 02:24:33 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 05 Apr 2005 09:24:33 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: References: <42515A83.4050907@emation.pt> Message-ID: <42524B41.3040300@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050405/5919abbb/attachment-0116.html From taj at www.linux.org.uk Tue Apr 5 03:00:29 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 10:00:29 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42524B41.3040300@emation.pt> References: <42515A83.4050907@emation.pt> <42524B41.3040300@emation.pt> Message-ID: On Tue, 5 Apr 2005, Ricardo Trindade wrote: > Will you anounce to the list when a new release is available ? > There will be several incremental releases announced here. Once those are done, we will release 2.1.7 and 2.0.7. -- Trent Jarvi taj at www.linux.org.uk From no_spam at somewhere.com Tue Apr 5 11:55:37 2005 From: no_spam at somewhere.com (no_spam@somewhere.com) Date: Tue, 5 Apr 2005 13:55:37 -0400 Subject: [Rxtx] Closing a port from an event listener results in a deadlock Message-ID: <20050405175537.GA21747@rcog.homelinux.net> On the message I sent on March 14, does anyone had the chance to try the modification? Or was it already fixed? (I haven't searched the archive extensively) Or maybe my message got catched by some spam filters? (it made it to the list archive though) Anyway, I would appreciate some feedback (through the list) Thanks From taj at www.linux.org.uk Tue Apr 5 14:42:28 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 21:42:28 +0100 (BST) Subject: [Rxtx] Closing a port from an event listener results in a deadlock In-Reply-To: <20050405175537.GA21747@rcog.homelinux.net> References: <20050405175537.GA21747@rcog.homelinux.net> Message-ID: On Tue, 5 Apr 2005 no_spam at somewhere.com wrote: > On the message I sent on March 14, does anyone had the chance to try the > modification? > > Or was it already fixed? (I haven't searched the archive extensively) > > Or maybe my message got catched by some spam filters? (it made it to the list > archive though) > > Anyway, I would appreciate some feedback (through the list) > The patch is here http://marc.theaimsgroup.com/?l=rxtx&m=111084488820288&w=2 I have applied this patch to a local copy but will not be doing formal testing for a couple weeks. I do not try to close ports from inside the eventListenter usually so I encourage any feedback also. If there are no problems reported, I expect this will go into rxtx 2.1-7. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Wed Apr 6 08:33:42 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Wed, 06 Apr 2005 15:33:42 +0100 Subject: [Rxtx] getting RXTX version Message-ID: <4253F346.50102@emation.pt> Hi, I want to make sure my deployments have the same version of RXTX jar and native lib. I know the version of the jar can be obtained in the Version class, but how can I obtain the native version ? I know RXTX prints to the console a warning if the version is different. Is there a way to programatically know is this is the case ? I would like to log that to our app's log thanks Ricardo From taj at www.linux.org.uk Wed Apr 6 15:10:20 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 6 Apr 2005 22:10:20 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4253F346.50102@emation.pt> References: <4253F346.50102@emation.pt> Message-ID: On Wed, 6 Apr 2005, Ricardo Trindade wrote: > Hi, > > I want to make sure my deployments have the same version of RXTX jar > and native lib. > > I know the version of the jar can be obtained in the Version class, > but how can I obtain the native version ? > > I know RXTX prints to the console a warning if the version is > different. Is there a way to programatically know is this is the case ? > > I would like to log that to our app's log > There isn't a suggested way of doing that right now. We could move things around and have a static String RXTXVersion.getNativeVersion() in future releases. Is this what you expected? This is not documented in commapi at all. I just tossed that in to catch conflicts while developing. It would be nice to have access in GUI applications though. It may be possible to access RXTXCommDriver.LibVersion right now. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Thu Apr 7 02:51:00 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 09:51:00 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> Message-ID: <4254F474.7020905@emation.pt> >There isn't a suggested way of doing that right now. We could move things >around and have a static String RXTXVersion.getNativeVersion() in future >releases. Is this what you expected? > > Yes, that would be perfect. >This is not documented in commapi at all. I just tossed that in to catch >conflicts while developing. It would be nice to have access in GUI >applications though. > >It may be possible to access RXTXCommDriver.LibVersion right now. > > > I tried, and I don't think it's possible. From taj at www.linux.org.uk Thu Apr 7 03:32:04 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 7 Apr 2005 10:32:04 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4254F474.7020905@emation.pt> References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: On Thu, 7 Apr 2005, Ricardo Trindade wrote: > > >There isn't a suggested way of doing that right now. We could move things > >around and have a static String RXTXVersion.getNativeVersion() in future > >releases. Is this what you expected? > > > > > > Yes, that would be perfect. > The attached should do what you want. You will still need to catch an exception for older versions... -- Trent Jarvi taj at www.linux.org.uk -------------- next part -------------- ? public_version.patch Index: RXTXCommDriver.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXCommDriver.java,v retrieving revision 1.16.2.51 diff -u -r1.16.2.51 RXTXCommDriver.java --- RXTXCommDriver.java 12 Oct 2004 09:13:30 -0000 1.16.2.51 +++ RXTXCommDriver.java 7 Apr 2005 09:29:04 -0000 @@ -54,7 +54,7 @@ the Library. */ String JarVersion = RXTXVersion.getVersion(); - String LibVersion = nativeGetVersion(); + String LibVersion = RXTXVersion.nativeGetVersion(); if ( devel ) { System.out.println("Devel Library"); @@ -76,7 +76,6 @@ /** Get the Serial port prefixes for the running OS */ private String deviceDirectory; private String osName; - private static native String nativeGetVersion(); private native boolean registerKnownPorts(int PortType); private native boolean isPortPrefixValid(String dev); private native boolean testRead(String dev, int type); Index: RXTXVersion.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXVersion.java,v retrieving revision 1.2.2.31 diff -u -r1.2.2.31 RXTXVersion.java --- RXTXVersion.java 16 Oct 2004 16:20:35 -0000 1.2.2.31 +++ RXTXVersion.java 7 Apr 2005 09:29:04 -0000 @@ -36,6 +36,7 @@ private static String Version; static { + System.loadLibrary( "rxtxSerial" ); Version = "RXTX-2.1-7pre20"; } /** @@ -47,4 +48,5 @@ { return(Version); } + public static native String nativeGetVersion(); } Index: SerialImp.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v retrieving revision 1.46.2.181 diff -u -r1.46.2.181 SerialImp.c --- SerialImp.c 17 Oct 2004 09:48:56 -0000 1.46.2.181 +++ SerialImp.c 7 Apr 2005 09:29:07 -0000 @@ -116,6 +116,7 @@ * It will eventually be removed. * */ #define RXTXPort(foo) Java_gnu_io_RXTXPort_ ## foo +#define RXTXVersion(foo) Java_gnu_io_RXTXVersion_ ## foo #define RXTXCommDriver(foo) Java_gnu_io_RXTXCommDriver_ ## foo #if defined(__sun__) || defined(__hpux__) @@ -4001,7 +4002,7 @@ } /*---------------------------------------------------------- -RXTXCommDriver.nativeGetVersion +RXTXVersion.nativeGetVersion accept: none perform: return the current version @@ -4010,9 +4011,10 @@ comments: This is used to avoid mixing versions of the .jar and native library. First introduced in rxtx-1.5-9 + Moved from RXTXCommDriver to RXTXVersion in rxtx-2.1-7 ----------------------------------------------------------*/ -JNIEXPORT jstring JNICALL RXTXCommDriver(nativeGetVersion) (JNIEnv *env, +JNIEXPORT jstring JNICALL RXTXVersion(nativeGetVersion) (JNIEnv *env, jclass jclazz ) { return (*env)->NewStringUTF( env, "RXTX-2.1-7pre20" ); From ricardo.trindade at emation.pt Thu Apr 7 03:45:58 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 10:45:58 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: <42550156.2040908@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050407/05212451/attachment-0116.html From thomas.shulok at lmco.com Thu Apr 7 17:43:11 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Thu, 07 Apr 2005 19:43:11 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi There, I'm attempting to talk RS232 between an embedded Linux box and a Windows box. Everything connects up fine, and I can send and receive a simple sequence of bytes with no problems. However, if around 5 seconds goes by without me sending something, I get the following when I attempt to send. java.io.IOException: Input/output error in writeArray Stack trace: java/lang/Throwable.()V java/lang/Throwable.(Ljava/lang/String;)V java/io/IOException.(Ljava/lang/String;)V gnu/io/RXTXPort.writeArray([BIIZ)V gnu/io/RXTXPort$SerialOutputStream.write([B)V SerialTest.main([Ljava/lang/String;)V If there interval is shorter (say 2 seconds between sends), I have no problems. On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and librxtxSerial-2.0.7pre2.so. Any ideas? Thanks, Thom -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5b23dcf/attachment-0116.html From taj at www.linux.org.uk Thu Apr 7 19:22:36 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:22:36 +0100 (BST) Subject: [Rxtx] Input/output error in writeArray In-Reply-To: References: Message-ID: On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a Windows > box. Everything connects up fine, and I can send and receive a simple > sequence of bytes with no problems. However, if around 5 seconds goes > by without me sending something, I get the following when I attempt to > send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Apr 7 19:24:59 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:24:59 +0100 (BST) Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) Message-ID: hmm. This would not work from applets would it? -- Trent Jarvi taj at www.linux.org.uk ---------- Forwarded message ---------- Date: Thu, 07 Apr 2005 16:05:53 -0400 From: Chris Gaffney To: taj at www.linux.org.uk Subject: RXTX Libraries on Classpath fix Hi, I submitted a patch for RXTX a few weeks ago to allow for loading the native libraries from the classpath. Since sending it to you I found it wasn't working on windows. I've fixed the problem and created a new patch that should replace the older one. The actual change is a one line from a String.equals() to a String.startsWith(). Thanks for a great piece of software, -Chris Gaffney Grand Valley State University -------------- next part -------------- A non-text attachment was scrubbed... Name: libraries_on_classpath_fixed.patch Type: text/x-patch Size: 5617 bytes Desc: Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5d423b8/libraries_on_classpath_fixed-0116.bin From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From thomas.shulok at lmco.com Fri Apr 8 10:38:55 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Fri, 08 Apr 2005 12:38:55 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi Trent, Thanks for the prompt response. Before diving deeper, I was wondering if there is a timeout parameter somewhere in the stack that I have not set properly. Given the nature of the failure (only fails if the line has been idle for a few seconds), it feels like some kind of timeout issue... Thanks again, Thom -----Original Message----- From: rxtx-bounces at mail.linuxgrrls.org [mailto:rxtx-bounces at mail.linuxgrrls.org] On Behalf Of Trent Jarvi Sent: Thursday, April 07, 2005 6:23 PM To: Java RXTX discussion Subject: Re: [Rxtx] Input/output error in writeArray On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a > Windows box. Everything connects up fine, and I can send and receive > a simple sequence of bytes with no problems. However, if around 5 > seconds goes by without me sending something, I get the following when > I attempt to send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at mail.linuxgrrls.org http://mail.linuxgrrls.org/mailman/listinfo/rxtx From ricardo.trindade at emation.pt Mon Apr 4 09:17:23 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Mon, 04 Apr 2005 16:17:23 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot Message-ID: <42515A83.4050907@emation.pt> Hi, I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most recent stable snapshot), and get the following exception : It looks like rxtx has been compiled with jdk 1.5. If this was indeed the case, I think there is a compilation flag that generates code that runs on older jdks. java.lang.UnsupportedClassVersionError: gnu/io/UnsupportedCommOperationException (Unsupported major.minor version 49.0) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at java.net.URLClassLoader.defineClass(URLClassLoader.java:251) at java.net.URLClassLoader.access$100(URLClassLoader.java:55) at java.net.URLClassLoader$1.run(URLClassLoader.java:194) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:187) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:141) I'm trying to run it with 1.4. thanks Ricardo From taj at www.linux.org.uk Tue Apr 5 00:48:12 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 07:48:12 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42515A83.4050907@emation.pt> References: <42515A83.4050907@emation.pt> Message-ID: On Mon, 4 Apr 2005, Ricardo Trindade wrote: > Hi, > > I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most > recent stable snapshot), and get the following exception : > > It looks like rxtx has been compiled with jdk 1.5. If this was > indeed the case, I think there is a compilation flag that generates code > that runs on older jdks. > > java.lang.UnsupportedClassVersionError: > gnu/io/UnsupportedCommOperationException (Unsupported major.minor > version 49.0) [snip] Thanks Ricardo I recompiled the jar with javac -source 1.3 -target 1.3. That should cover most of the JRE's in use today. I also compiled the rxtx 2.0 x86_64 native library which appeared to be missing. I tried looking for flags to pass gcc 4.0 to make the native libraries more backwards compatible but only found options for C++ which is not used in rxtx. I've got a list of other bugs that I'll be going through in the next few weeks but for now I just left them with the same CVS filename - no code changes. ftp://ftp.qbang.org/pub/rxtx/rxtx-2.0-CVS-20050120-bins.tar.gz ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-CVS-20050120-bins.tar.gz -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Tue Apr 5 02:24:33 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 05 Apr 2005 09:24:33 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: References: <42515A83.4050907@emation.pt> Message-ID: <42524B41.3040300@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050405/5919abbb/attachment-0117.html From taj at www.linux.org.uk Tue Apr 5 03:00:29 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 10:00:29 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42524B41.3040300@emation.pt> References: <42515A83.4050907@emation.pt> <42524B41.3040300@emation.pt> Message-ID: On Tue, 5 Apr 2005, Ricardo Trindade wrote: > Will you anounce to the list when a new release is available ? > There will be several incremental releases announced here. Once those are done, we will release 2.1.7 and 2.0.7. -- Trent Jarvi taj at www.linux.org.uk From no_spam at somewhere.com Tue Apr 5 11:55:37 2005 From: no_spam at somewhere.com (no_spam@somewhere.com) Date: Tue, 5 Apr 2005 13:55:37 -0400 Subject: [Rxtx] Closing a port from an event listener results in a deadlock Message-ID: <20050405175537.GA21747@rcog.homelinux.net> On the message I sent on March 14, does anyone had the chance to try the modification? Or was it already fixed? (I haven't searched the archive extensively) Or maybe my message got catched by some spam filters? (it made it to the list archive though) Anyway, I would appreciate some feedback (through the list) Thanks From taj at www.linux.org.uk Tue Apr 5 14:42:28 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 21:42:28 +0100 (BST) Subject: [Rxtx] Closing a port from an event listener results in a deadlock In-Reply-To: <20050405175537.GA21747@rcog.homelinux.net> References: <20050405175537.GA21747@rcog.homelinux.net> Message-ID: On Tue, 5 Apr 2005 no_spam at somewhere.com wrote: > On the message I sent on March 14, does anyone had the chance to try the > modification? > > Or was it already fixed? (I haven't searched the archive extensively) > > Or maybe my message got catched by some spam filters? (it made it to the list > archive though) > > Anyway, I would appreciate some feedback (through the list) > The patch is here http://marc.theaimsgroup.com/?l=rxtx&m=111084488820288&w=2 I have applied this patch to a local copy but will not be doing formal testing for a couple weeks. I do not try to close ports from inside the eventListenter usually so I encourage any feedback also. If there are no problems reported, I expect this will go into rxtx 2.1-7. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Wed Apr 6 08:33:42 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Wed, 06 Apr 2005 15:33:42 +0100 Subject: [Rxtx] getting RXTX version Message-ID: <4253F346.50102@emation.pt> Hi, I want to make sure my deployments have the same version of RXTX jar and native lib. I know the version of the jar can be obtained in the Version class, but how can I obtain the native version ? I know RXTX prints to the console a warning if the version is different. Is there a way to programatically know is this is the case ? I would like to log that to our app's log thanks Ricardo From taj at www.linux.org.uk Wed Apr 6 15:10:20 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 6 Apr 2005 22:10:20 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4253F346.50102@emation.pt> References: <4253F346.50102@emation.pt> Message-ID: On Wed, 6 Apr 2005, Ricardo Trindade wrote: > Hi, > > I want to make sure my deployments have the same version of RXTX jar > and native lib. > > I know the version of the jar can be obtained in the Version class, > but how can I obtain the native version ? > > I know RXTX prints to the console a warning if the version is > different. Is there a way to programatically know is this is the case ? > > I would like to log that to our app's log > There isn't a suggested way of doing that right now. We could move things around and have a static String RXTXVersion.getNativeVersion() in future releases. Is this what you expected? This is not documented in commapi at all. I just tossed that in to catch conflicts while developing. It would be nice to have access in GUI applications though. It may be possible to access RXTXCommDriver.LibVersion right now. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Thu Apr 7 02:51:00 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 09:51:00 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> Message-ID: <4254F474.7020905@emation.pt> >There isn't a suggested way of doing that right now. We could move things >around and have a static String RXTXVersion.getNativeVersion() in future >releases. Is this what you expected? > > Yes, that would be perfect. >This is not documented in commapi at all. I just tossed that in to catch >conflicts while developing. It would be nice to have access in GUI >applications though. > >It may be possible to access RXTXCommDriver.LibVersion right now. > > > I tried, and I don't think it's possible. From taj at www.linux.org.uk Thu Apr 7 03:32:04 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 7 Apr 2005 10:32:04 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4254F474.7020905@emation.pt> References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: On Thu, 7 Apr 2005, Ricardo Trindade wrote: > > >There isn't a suggested way of doing that right now. We could move things > >around and have a static String RXTXVersion.getNativeVersion() in future > >releases. Is this what you expected? > > > > > > Yes, that would be perfect. > The attached should do what you want. You will still need to catch an exception for older versions... -- Trent Jarvi taj at www.linux.org.uk -------------- next part -------------- ? public_version.patch Index: RXTXCommDriver.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXCommDriver.java,v retrieving revision 1.16.2.51 diff -u -r1.16.2.51 RXTXCommDriver.java --- RXTXCommDriver.java 12 Oct 2004 09:13:30 -0000 1.16.2.51 +++ RXTXCommDriver.java 7 Apr 2005 09:29:04 -0000 @@ -54,7 +54,7 @@ the Library. */ String JarVersion = RXTXVersion.getVersion(); - String LibVersion = nativeGetVersion(); + String LibVersion = RXTXVersion.nativeGetVersion(); if ( devel ) { System.out.println("Devel Library"); @@ -76,7 +76,6 @@ /** Get the Serial port prefixes for the running OS */ private String deviceDirectory; private String osName; - private static native String nativeGetVersion(); private native boolean registerKnownPorts(int PortType); private native boolean isPortPrefixValid(String dev); private native boolean testRead(String dev, int type); Index: RXTXVersion.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXVersion.java,v retrieving revision 1.2.2.31 diff -u -r1.2.2.31 RXTXVersion.java --- RXTXVersion.java 16 Oct 2004 16:20:35 -0000 1.2.2.31 +++ RXTXVersion.java 7 Apr 2005 09:29:04 -0000 @@ -36,6 +36,7 @@ private static String Version; static { + System.loadLibrary( "rxtxSerial" ); Version = "RXTX-2.1-7pre20"; } /** @@ -47,4 +48,5 @@ { return(Version); } + public static native String nativeGetVersion(); } Index: SerialImp.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v retrieving revision 1.46.2.181 diff -u -r1.46.2.181 SerialImp.c --- SerialImp.c 17 Oct 2004 09:48:56 -0000 1.46.2.181 +++ SerialImp.c 7 Apr 2005 09:29:07 -0000 @@ -116,6 +116,7 @@ * It will eventually be removed. * */ #define RXTXPort(foo) Java_gnu_io_RXTXPort_ ## foo +#define RXTXVersion(foo) Java_gnu_io_RXTXVersion_ ## foo #define RXTXCommDriver(foo) Java_gnu_io_RXTXCommDriver_ ## foo #if defined(__sun__) || defined(__hpux__) @@ -4001,7 +4002,7 @@ } /*---------------------------------------------------------- -RXTXCommDriver.nativeGetVersion +RXTXVersion.nativeGetVersion accept: none perform: return the current version @@ -4010,9 +4011,10 @@ comments: This is used to avoid mixing versions of the .jar and native library. First introduced in rxtx-1.5-9 + Moved from RXTXCommDriver to RXTXVersion in rxtx-2.1-7 ----------------------------------------------------------*/ -JNIEXPORT jstring JNICALL RXTXCommDriver(nativeGetVersion) (JNIEnv *env, +JNIEXPORT jstring JNICALL RXTXVersion(nativeGetVersion) (JNIEnv *env, jclass jclazz ) { return (*env)->NewStringUTF( env, "RXTX-2.1-7pre20" ); From ricardo.trindade at emation.pt Thu Apr 7 03:45:58 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 10:45:58 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: <42550156.2040908@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050407/05212451/attachment-0117.html From thomas.shulok at lmco.com Thu Apr 7 17:43:11 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Thu, 07 Apr 2005 19:43:11 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi There, I'm attempting to talk RS232 between an embedded Linux box and a Windows box. Everything connects up fine, and I can send and receive a simple sequence of bytes with no problems. However, if around 5 seconds goes by without me sending something, I get the following when I attempt to send. java.io.IOException: Input/output error in writeArray Stack trace: java/lang/Throwable.()V java/lang/Throwable.(Ljava/lang/String;)V java/io/IOException.(Ljava/lang/String;)V gnu/io/RXTXPort.writeArray([BIIZ)V gnu/io/RXTXPort$SerialOutputStream.write([B)V SerialTest.main([Ljava/lang/String;)V If there interval is shorter (say 2 seconds between sends), I have no problems. On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and librxtxSerial-2.0.7pre2.so. Any ideas? Thanks, Thom -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5b23dcf/attachment-0117.html From taj at www.linux.org.uk Thu Apr 7 19:22:36 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:22:36 +0100 (BST) Subject: [Rxtx] Input/output error in writeArray In-Reply-To: References: Message-ID: On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a Windows > box. Everything connects up fine, and I can send and receive a simple > sequence of bytes with no problems. However, if around 5 seconds goes > by without me sending something, I get the following when I attempt to > send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Apr 7 19:24:59 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:24:59 +0100 (BST) Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) Message-ID: hmm. This would not work from applets would it? -- Trent Jarvi taj at www.linux.org.uk ---------- Forwarded message ---------- Date: Thu, 07 Apr 2005 16:05:53 -0400 From: Chris Gaffney To: taj at www.linux.org.uk Subject: RXTX Libraries on Classpath fix Hi, I submitted a patch for RXTX a few weeks ago to allow for loading the native libraries from the classpath. Since sending it to you I found it wasn't working on windows. I've fixed the problem and created a new patch that should replace the older one. The actual change is a one line from a String.equals() to a String.startsWith(). Thanks for a great piece of software, -Chris Gaffney Grand Valley State University -------------- next part -------------- A non-text attachment was scrubbed... Name: libraries_on_classpath_fixed.patch Type: text/x-patch Size: 5617 bytes Desc: Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5d423b8/libraries_on_classpath_fixed-0117.bin From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From thomas.shulok at lmco.com Fri Apr 8 10:38:55 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Fri, 08 Apr 2005 12:38:55 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi Trent, Thanks for the prompt response. Before diving deeper, I was wondering if there is a timeout parameter somewhere in the stack that I have not set properly. Given the nature of the failure (only fails if the line has been idle for a few seconds), it feels like some kind of timeout issue... Thanks again, Thom -----Original Message----- From: rxtx-bounces at mail.linuxgrrls.org [mailto:rxtx-bounces at mail.linuxgrrls.org] On Behalf Of Trent Jarvi Sent: Thursday, April 07, 2005 6:23 PM To: Java RXTX discussion Subject: Re: [Rxtx] Input/output error in writeArray On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a > Windows box. Everything connects up fine, and I can send and receive > a simple sequence of bytes with no problems. However, if around 5 > seconds goes by without me sending something, I get the following when > I attempt to send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at mail.linuxgrrls.org http://mail.linuxgrrls.org/mailman/listinfo/rxtx From ricardo.trindade at emation.pt Mon Apr 4 09:17:23 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Mon, 04 Apr 2005 16:17:23 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot Message-ID: <42515A83.4050907@emation.pt> Hi, I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most recent stable snapshot), and get the following exception : It looks like rxtx has been compiled with jdk 1.5. If this was indeed the case, I think there is a compilation flag that generates code that runs on older jdks. java.lang.UnsupportedClassVersionError: gnu/io/UnsupportedCommOperationException (Unsupported major.minor version 49.0) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at java.net.URLClassLoader.defineClass(URLClassLoader.java:251) at java.net.URLClassLoader.access$100(URLClassLoader.java:55) at java.net.URLClassLoader$1.run(URLClassLoader.java:194) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:187) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:141) I'm trying to run it with 1.4. thanks Ricardo From taj at www.linux.org.uk Tue Apr 5 00:48:12 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 07:48:12 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42515A83.4050907@emation.pt> References: <42515A83.4050907@emation.pt> Message-ID: On Mon, 4 Apr 2005, Ricardo Trindade wrote: > Hi, > > I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most > recent stable snapshot), and get the following exception : > > It looks like rxtx has been compiled with jdk 1.5. If this was > indeed the case, I think there is a compilation flag that generates code > that runs on older jdks. > > java.lang.UnsupportedClassVersionError: > gnu/io/UnsupportedCommOperationException (Unsupported major.minor > version 49.0) [snip] Thanks Ricardo I recompiled the jar with javac -source 1.3 -target 1.3. That should cover most of the JRE's in use today. I also compiled the rxtx 2.0 x86_64 native library which appeared to be missing. I tried looking for flags to pass gcc 4.0 to make the native libraries more backwards compatible but only found options for C++ which is not used in rxtx. I've got a list of other bugs that I'll be going through in the next few weeks but for now I just left them with the same CVS filename - no code changes. ftp://ftp.qbang.org/pub/rxtx/rxtx-2.0-CVS-20050120-bins.tar.gz ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-CVS-20050120-bins.tar.gz -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Tue Apr 5 02:24:33 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 05 Apr 2005 09:24:33 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: References: <42515A83.4050907@emation.pt> Message-ID: <42524B41.3040300@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050405/5919abbb/attachment-0118.html From taj at www.linux.org.uk Tue Apr 5 03:00:29 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 10:00:29 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42524B41.3040300@emation.pt> References: <42515A83.4050907@emation.pt> <42524B41.3040300@emation.pt> Message-ID: On Tue, 5 Apr 2005, Ricardo Trindade wrote: > Will you anounce to the list when a new release is available ? > There will be several incremental releases announced here. Once those are done, we will release 2.1.7 and 2.0.7. -- Trent Jarvi taj at www.linux.org.uk From no_spam at somewhere.com Tue Apr 5 11:55:37 2005 From: no_spam at somewhere.com (no_spam@somewhere.com) Date: Tue, 5 Apr 2005 13:55:37 -0400 Subject: [Rxtx] Closing a port from an event listener results in a deadlock Message-ID: <20050405175537.GA21747@rcog.homelinux.net> On the message I sent on March 14, does anyone had the chance to try the modification? Or was it already fixed? (I haven't searched the archive extensively) Or maybe my message got catched by some spam filters? (it made it to the list archive though) Anyway, I would appreciate some feedback (through the list) Thanks From taj at www.linux.org.uk Tue Apr 5 14:42:28 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 21:42:28 +0100 (BST) Subject: [Rxtx] Closing a port from an event listener results in a deadlock In-Reply-To: <20050405175537.GA21747@rcog.homelinux.net> References: <20050405175537.GA21747@rcog.homelinux.net> Message-ID: On Tue, 5 Apr 2005 no_spam at somewhere.com wrote: > On the message I sent on March 14, does anyone had the chance to try the > modification? > > Or was it already fixed? (I haven't searched the archive extensively) > > Or maybe my message got catched by some spam filters? (it made it to the list > archive though) > > Anyway, I would appreciate some feedback (through the list) > The patch is here http://marc.theaimsgroup.com/?l=rxtx&m=111084488820288&w=2 I have applied this patch to a local copy but will not be doing formal testing for a couple weeks. I do not try to close ports from inside the eventListenter usually so I encourage any feedback also. If there are no problems reported, I expect this will go into rxtx 2.1-7. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Wed Apr 6 08:33:42 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Wed, 06 Apr 2005 15:33:42 +0100 Subject: [Rxtx] getting RXTX version Message-ID: <4253F346.50102@emation.pt> Hi, I want to make sure my deployments have the same version of RXTX jar and native lib. I know the version of the jar can be obtained in the Version class, but how can I obtain the native version ? I know RXTX prints to the console a warning if the version is different. Is there a way to programatically know is this is the case ? I would like to log that to our app's log thanks Ricardo From taj at www.linux.org.uk Wed Apr 6 15:10:20 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 6 Apr 2005 22:10:20 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4253F346.50102@emation.pt> References: <4253F346.50102@emation.pt> Message-ID: On Wed, 6 Apr 2005, Ricardo Trindade wrote: > Hi, > > I want to make sure my deployments have the same version of RXTX jar > and native lib. > > I know the version of the jar can be obtained in the Version class, > but how can I obtain the native version ? > > I know RXTX prints to the console a warning if the version is > different. Is there a way to programatically know is this is the case ? > > I would like to log that to our app's log > There isn't a suggested way of doing that right now. We could move things around and have a static String RXTXVersion.getNativeVersion() in future releases. Is this what you expected? This is not documented in commapi at all. I just tossed that in to catch conflicts while developing. It would be nice to have access in GUI applications though. It may be possible to access RXTXCommDriver.LibVersion right now. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Thu Apr 7 02:51:00 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 09:51:00 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> Message-ID: <4254F474.7020905@emation.pt> >There isn't a suggested way of doing that right now. We could move things >around and have a static String RXTXVersion.getNativeVersion() in future >releases. Is this what you expected? > > Yes, that would be perfect. >This is not documented in commapi at all. I just tossed that in to catch >conflicts while developing. It would be nice to have access in GUI >applications though. > >It may be possible to access RXTXCommDriver.LibVersion right now. > > > I tried, and I don't think it's possible. From taj at www.linux.org.uk Thu Apr 7 03:32:04 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 7 Apr 2005 10:32:04 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4254F474.7020905@emation.pt> References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: On Thu, 7 Apr 2005, Ricardo Trindade wrote: > > >There isn't a suggested way of doing that right now. We could move things > >around and have a static String RXTXVersion.getNativeVersion() in future > >releases. Is this what you expected? > > > > > > Yes, that would be perfect. > The attached should do what you want. You will still need to catch an exception for older versions... -- Trent Jarvi taj at www.linux.org.uk -------------- next part -------------- ? public_version.patch Index: RXTXCommDriver.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXCommDriver.java,v retrieving revision 1.16.2.51 diff -u -r1.16.2.51 RXTXCommDriver.java --- RXTXCommDriver.java 12 Oct 2004 09:13:30 -0000 1.16.2.51 +++ RXTXCommDriver.java 7 Apr 2005 09:29:04 -0000 @@ -54,7 +54,7 @@ the Library. */ String JarVersion = RXTXVersion.getVersion(); - String LibVersion = nativeGetVersion(); + String LibVersion = RXTXVersion.nativeGetVersion(); if ( devel ) { System.out.println("Devel Library"); @@ -76,7 +76,6 @@ /** Get the Serial port prefixes for the running OS */ private String deviceDirectory; private String osName; - private static native String nativeGetVersion(); private native boolean registerKnownPorts(int PortType); private native boolean isPortPrefixValid(String dev); private native boolean testRead(String dev, int type); Index: RXTXVersion.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXVersion.java,v retrieving revision 1.2.2.31 diff -u -r1.2.2.31 RXTXVersion.java --- RXTXVersion.java 16 Oct 2004 16:20:35 -0000 1.2.2.31 +++ RXTXVersion.java 7 Apr 2005 09:29:04 -0000 @@ -36,6 +36,7 @@ private static String Version; static { + System.loadLibrary( "rxtxSerial" ); Version = "RXTX-2.1-7pre20"; } /** @@ -47,4 +48,5 @@ { return(Version); } + public static native String nativeGetVersion(); } Index: SerialImp.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v retrieving revision 1.46.2.181 diff -u -r1.46.2.181 SerialImp.c --- SerialImp.c 17 Oct 2004 09:48:56 -0000 1.46.2.181 +++ SerialImp.c 7 Apr 2005 09:29:07 -0000 @@ -116,6 +116,7 @@ * It will eventually be removed. * */ #define RXTXPort(foo) Java_gnu_io_RXTXPort_ ## foo +#define RXTXVersion(foo) Java_gnu_io_RXTXVersion_ ## foo #define RXTXCommDriver(foo) Java_gnu_io_RXTXCommDriver_ ## foo #if defined(__sun__) || defined(__hpux__) @@ -4001,7 +4002,7 @@ } /*---------------------------------------------------------- -RXTXCommDriver.nativeGetVersion +RXTXVersion.nativeGetVersion accept: none perform: return the current version @@ -4010,9 +4011,10 @@ comments: This is used to avoid mixing versions of the .jar and native library. First introduced in rxtx-1.5-9 + Moved from RXTXCommDriver to RXTXVersion in rxtx-2.1-7 ----------------------------------------------------------*/ -JNIEXPORT jstring JNICALL RXTXCommDriver(nativeGetVersion) (JNIEnv *env, +JNIEXPORT jstring JNICALL RXTXVersion(nativeGetVersion) (JNIEnv *env, jclass jclazz ) { return (*env)->NewStringUTF( env, "RXTX-2.1-7pre20" ); From ricardo.trindade at emation.pt Thu Apr 7 03:45:58 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 10:45:58 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: <42550156.2040908@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050407/05212451/attachment-0118.html From thomas.shulok at lmco.com Thu Apr 7 17:43:11 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Thu, 07 Apr 2005 19:43:11 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi There, I'm attempting to talk RS232 between an embedded Linux box and a Windows box. Everything connects up fine, and I can send and receive a simple sequence of bytes with no problems. However, if around 5 seconds goes by without me sending something, I get the following when I attempt to send. java.io.IOException: Input/output error in writeArray Stack trace: java/lang/Throwable.()V java/lang/Throwable.(Ljava/lang/String;)V java/io/IOException.(Ljava/lang/String;)V gnu/io/RXTXPort.writeArray([BIIZ)V gnu/io/RXTXPort$SerialOutputStream.write([B)V SerialTest.main([Ljava/lang/String;)V If there interval is shorter (say 2 seconds between sends), I have no problems. On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and librxtxSerial-2.0.7pre2.so. Any ideas? Thanks, Thom -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5b23dcf/attachment-0118.html From taj at www.linux.org.uk Thu Apr 7 19:22:36 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:22:36 +0100 (BST) Subject: [Rxtx] Input/output error in writeArray In-Reply-To: References: Message-ID: On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a Windows > box. Everything connects up fine, and I can send and receive a simple > sequence of bytes with no problems. However, if around 5 seconds goes > by without me sending something, I get the following when I attempt to > send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Apr 7 19:24:59 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:24:59 +0100 (BST) Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) Message-ID: hmm. This would not work from applets would it? -- Trent Jarvi taj at www.linux.org.uk ---------- Forwarded message ---------- Date: Thu, 07 Apr 2005 16:05:53 -0400 From: Chris Gaffney To: taj at www.linux.org.uk Subject: RXTX Libraries on Classpath fix Hi, I submitted a patch for RXTX a few weeks ago to allow for loading the native libraries from the classpath. Since sending it to you I found it wasn't working on windows. I've fixed the problem and created a new patch that should replace the older one. The actual change is a one line from a String.equals() to a String.startsWith(). Thanks for a great piece of software, -Chris Gaffney Grand Valley State University -------------- next part -------------- A non-text attachment was scrubbed... Name: libraries_on_classpath_fixed.patch Type: text/x-patch Size: 5617 bytes Desc: Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5d423b8/libraries_on_classpath_fixed-0118.bin From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From thomas.shulok at lmco.com Fri Apr 8 10:38:55 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Fri, 08 Apr 2005 12:38:55 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi Trent, Thanks for the prompt response. Before diving deeper, I was wondering if there is a timeout parameter somewhere in the stack that I have not set properly. Given the nature of the failure (only fails if the line has been idle for a few seconds), it feels like some kind of timeout issue... Thanks again, Thom -----Original Message----- From: rxtx-bounces at mail.linuxgrrls.org [mailto:rxtx-bounces at mail.linuxgrrls.org] On Behalf Of Trent Jarvi Sent: Thursday, April 07, 2005 6:23 PM To: Java RXTX discussion Subject: Re: [Rxtx] Input/output error in writeArray On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a > Windows box. Everything connects up fine, and I can send and receive > a simple sequence of bytes with no problems. However, if around 5 > seconds goes by without me sending something, I get the following when > I attempt to send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at mail.linuxgrrls.org http://mail.linuxgrrls.org/mailman/listinfo/rxtx From ricardo.trindade at emation.pt Mon Apr 4 09:17:23 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Mon, 04 Apr 2005 16:17:23 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot Message-ID: <42515A83.4050907@emation.pt> Hi, I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most recent stable snapshot), and get the following exception : It looks like rxtx has been compiled with jdk 1.5. If this was indeed the case, I think there is a compilation flag that generates code that runs on older jdks. java.lang.UnsupportedClassVersionError: gnu/io/UnsupportedCommOperationException (Unsupported major.minor version 49.0) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at java.net.URLClassLoader.defineClass(URLClassLoader.java:251) at java.net.URLClassLoader.access$100(URLClassLoader.java:55) at java.net.URLClassLoader$1.run(URLClassLoader.java:194) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:187) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:141) I'm trying to run it with 1.4. thanks Ricardo From taj at www.linux.org.uk Tue Apr 5 00:48:12 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 07:48:12 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42515A83.4050907@emation.pt> References: <42515A83.4050907@emation.pt> Message-ID: On Mon, 4 Apr 2005, Ricardo Trindade wrote: > Hi, > > I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most > recent stable snapshot), and get the following exception : > > It looks like rxtx has been compiled with jdk 1.5. If this was > indeed the case, I think there is a compilation flag that generates code > that runs on older jdks. > > java.lang.UnsupportedClassVersionError: > gnu/io/UnsupportedCommOperationException (Unsupported major.minor > version 49.0) [snip] Thanks Ricardo I recompiled the jar with javac -source 1.3 -target 1.3. That should cover most of the JRE's in use today. I also compiled the rxtx 2.0 x86_64 native library which appeared to be missing. I tried looking for flags to pass gcc 4.0 to make the native libraries more backwards compatible but only found options for C++ which is not used in rxtx. I've got a list of other bugs that I'll be going through in the next few weeks but for now I just left them with the same CVS filename - no code changes. ftp://ftp.qbang.org/pub/rxtx/rxtx-2.0-CVS-20050120-bins.tar.gz ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-CVS-20050120-bins.tar.gz -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Tue Apr 5 02:24:33 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 05 Apr 2005 09:24:33 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: References: <42515A83.4050907@emation.pt> Message-ID: <42524B41.3040300@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050405/5919abbb/attachment-0119.html From taj at www.linux.org.uk Tue Apr 5 03:00:29 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 10:00:29 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42524B41.3040300@emation.pt> References: <42515A83.4050907@emation.pt> <42524B41.3040300@emation.pt> Message-ID: On Tue, 5 Apr 2005, Ricardo Trindade wrote: > Will you anounce to the list when a new release is available ? > There will be several incremental releases announced here. Once those are done, we will release 2.1.7 and 2.0.7. -- Trent Jarvi taj at www.linux.org.uk From no_spam at somewhere.com Tue Apr 5 11:55:37 2005 From: no_spam at somewhere.com (no_spam@somewhere.com) Date: Tue, 5 Apr 2005 13:55:37 -0400 Subject: [Rxtx] Closing a port from an event listener results in a deadlock Message-ID: <20050405175537.GA21747@rcog.homelinux.net> On the message I sent on March 14, does anyone had the chance to try the modification? Or was it already fixed? (I haven't searched the archive extensively) Or maybe my message got catched by some spam filters? (it made it to the list archive though) Anyway, I would appreciate some feedback (through the list) Thanks From taj at www.linux.org.uk Tue Apr 5 14:42:28 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 21:42:28 +0100 (BST) Subject: [Rxtx] Closing a port from an event listener results in a deadlock In-Reply-To: <20050405175537.GA21747@rcog.homelinux.net> References: <20050405175537.GA21747@rcog.homelinux.net> Message-ID: On Tue, 5 Apr 2005 no_spam at somewhere.com wrote: > On the message I sent on March 14, does anyone had the chance to try the > modification? > > Or was it already fixed? (I haven't searched the archive extensively) > > Or maybe my message got catched by some spam filters? (it made it to the list > archive though) > > Anyway, I would appreciate some feedback (through the list) > The patch is here http://marc.theaimsgroup.com/?l=rxtx&m=111084488820288&w=2 I have applied this patch to a local copy but will not be doing formal testing for a couple weeks. I do not try to close ports from inside the eventListenter usually so I encourage any feedback also. If there are no problems reported, I expect this will go into rxtx 2.1-7. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Wed Apr 6 08:33:42 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Wed, 06 Apr 2005 15:33:42 +0100 Subject: [Rxtx] getting RXTX version Message-ID: <4253F346.50102@emation.pt> Hi, I want to make sure my deployments have the same version of RXTX jar and native lib. I know the version of the jar can be obtained in the Version class, but how can I obtain the native version ? I know RXTX prints to the console a warning if the version is different. Is there a way to programatically know is this is the case ? I would like to log that to our app's log thanks Ricardo From taj at www.linux.org.uk Wed Apr 6 15:10:20 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 6 Apr 2005 22:10:20 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4253F346.50102@emation.pt> References: <4253F346.50102@emation.pt> Message-ID: On Wed, 6 Apr 2005, Ricardo Trindade wrote: > Hi, > > I want to make sure my deployments have the same version of RXTX jar > and native lib. > > I know the version of the jar can be obtained in the Version class, > but how can I obtain the native version ? > > I know RXTX prints to the console a warning if the version is > different. Is there a way to programatically know is this is the case ? > > I would like to log that to our app's log > There isn't a suggested way of doing that right now. We could move things around and have a static String RXTXVersion.getNativeVersion() in future releases. Is this what you expected? This is not documented in commapi at all. I just tossed that in to catch conflicts while developing. It would be nice to have access in GUI applications though. It may be possible to access RXTXCommDriver.LibVersion right now. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Thu Apr 7 02:51:00 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 09:51:00 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> Message-ID: <4254F474.7020905@emation.pt> >There isn't a suggested way of doing that right now. We could move things >around and have a static String RXTXVersion.getNativeVersion() in future >releases. Is this what you expected? > > Yes, that would be perfect. >This is not documented in commapi at all. I just tossed that in to catch >conflicts while developing. It would be nice to have access in GUI >applications though. > >It may be possible to access RXTXCommDriver.LibVersion right now. > > > I tried, and I don't think it's possible. From taj at www.linux.org.uk Thu Apr 7 03:32:04 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 7 Apr 2005 10:32:04 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4254F474.7020905@emation.pt> References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: On Thu, 7 Apr 2005, Ricardo Trindade wrote: > > >There isn't a suggested way of doing that right now. We could move things > >around and have a static String RXTXVersion.getNativeVersion() in future > >releases. Is this what you expected? > > > > > > Yes, that would be perfect. > The attached should do what you want. You will still need to catch an exception for older versions... -- Trent Jarvi taj at www.linux.org.uk -------------- next part -------------- ? public_version.patch Index: RXTXCommDriver.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXCommDriver.java,v retrieving revision 1.16.2.51 diff -u -r1.16.2.51 RXTXCommDriver.java --- RXTXCommDriver.java 12 Oct 2004 09:13:30 -0000 1.16.2.51 +++ RXTXCommDriver.java 7 Apr 2005 09:29:04 -0000 @@ -54,7 +54,7 @@ the Library. */ String JarVersion = RXTXVersion.getVersion(); - String LibVersion = nativeGetVersion(); + String LibVersion = RXTXVersion.nativeGetVersion(); if ( devel ) { System.out.println("Devel Library"); @@ -76,7 +76,6 @@ /** Get the Serial port prefixes for the running OS */ private String deviceDirectory; private String osName; - private static native String nativeGetVersion(); private native boolean registerKnownPorts(int PortType); private native boolean isPortPrefixValid(String dev); private native boolean testRead(String dev, int type); Index: RXTXVersion.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXVersion.java,v retrieving revision 1.2.2.31 diff -u -r1.2.2.31 RXTXVersion.java --- RXTXVersion.java 16 Oct 2004 16:20:35 -0000 1.2.2.31 +++ RXTXVersion.java 7 Apr 2005 09:29:04 -0000 @@ -36,6 +36,7 @@ private static String Version; static { + System.loadLibrary( "rxtxSerial" ); Version = "RXTX-2.1-7pre20"; } /** @@ -47,4 +48,5 @@ { return(Version); } + public static native String nativeGetVersion(); } Index: SerialImp.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v retrieving revision 1.46.2.181 diff -u -r1.46.2.181 SerialImp.c --- SerialImp.c 17 Oct 2004 09:48:56 -0000 1.46.2.181 +++ SerialImp.c 7 Apr 2005 09:29:07 -0000 @@ -116,6 +116,7 @@ * It will eventually be removed. * */ #define RXTXPort(foo) Java_gnu_io_RXTXPort_ ## foo +#define RXTXVersion(foo) Java_gnu_io_RXTXVersion_ ## foo #define RXTXCommDriver(foo) Java_gnu_io_RXTXCommDriver_ ## foo #if defined(__sun__) || defined(__hpux__) @@ -4001,7 +4002,7 @@ } /*---------------------------------------------------------- -RXTXCommDriver.nativeGetVersion +RXTXVersion.nativeGetVersion accept: none perform: return the current version @@ -4010,9 +4011,10 @@ comments: This is used to avoid mixing versions of the .jar and native library. First introduced in rxtx-1.5-9 + Moved from RXTXCommDriver to RXTXVersion in rxtx-2.1-7 ----------------------------------------------------------*/ -JNIEXPORT jstring JNICALL RXTXCommDriver(nativeGetVersion) (JNIEnv *env, +JNIEXPORT jstring JNICALL RXTXVersion(nativeGetVersion) (JNIEnv *env, jclass jclazz ) { return (*env)->NewStringUTF( env, "RXTX-2.1-7pre20" ); From ricardo.trindade at emation.pt Thu Apr 7 03:45:58 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 10:45:58 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: <42550156.2040908@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050407/05212451/attachment-0119.html From thomas.shulok at lmco.com Thu Apr 7 17:43:11 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Thu, 07 Apr 2005 19:43:11 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi There, I'm attempting to talk RS232 between an embedded Linux box and a Windows box. Everything connects up fine, and I can send and receive a simple sequence of bytes with no problems. However, if around 5 seconds goes by without me sending something, I get the following when I attempt to send. java.io.IOException: Input/output error in writeArray Stack trace: java/lang/Throwable.()V java/lang/Throwable.(Ljava/lang/String;)V java/io/IOException.(Ljava/lang/String;)V gnu/io/RXTXPort.writeArray([BIIZ)V gnu/io/RXTXPort$SerialOutputStream.write([B)V SerialTest.main([Ljava/lang/String;)V If there interval is shorter (say 2 seconds between sends), I have no problems. On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and librxtxSerial-2.0.7pre2.so. Any ideas? Thanks, Thom -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5b23dcf/attachment-0119.html From taj at www.linux.org.uk Thu Apr 7 19:22:36 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:22:36 +0100 (BST) Subject: [Rxtx] Input/output error in writeArray In-Reply-To: References: Message-ID: On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a Windows > box. Everything connects up fine, and I can send and receive a simple > sequence of bytes with no problems. However, if around 5 seconds goes > by without me sending something, I get the following when I attempt to > send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Apr 7 19:24:59 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:24:59 +0100 (BST) Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) Message-ID: hmm. This would not work from applets would it? -- Trent Jarvi taj at www.linux.org.uk ---------- Forwarded message ---------- Date: Thu, 07 Apr 2005 16:05:53 -0400 From: Chris Gaffney To: taj at www.linux.org.uk Subject: RXTX Libraries on Classpath fix Hi, I submitted a patch for RXTX a few weeks ago to allow for loading the native libraries from the classpath. Since sending it to you I found it wasn't working on windows. I've fixed the problem and created a new patch that should replace the older one. The actual change is a one line from a String.equals() to a String.startsWith(). Thanks for a great piece of software, -Chris Gaffney Grand Valley State University -------------- next part -------------- A non-text attachment was scrubbed... Name: libraries_on_classpath_fixed.patch Type: text/x-patch Size: 5617 bytes Desc: Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5d423b8/libraries_on_classpath_fixed-0119.bin From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From thomas.shulok at lmco.com Fri Apr 8 10:38:55 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Fri, 08 Apr 2005 12:38:55 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi Trent, Thanks for the prompt response. Before diving deeper, I was wondering if there is a timeout parameter somewhere in the stack that I have not set properly. Given the nature of the failure (only fails if the line has been idle for a few seconds), it feels like some kind of timeout issue... Thanks again, Thom -----Original Message----- From: rxtx-bounces at mail.linuxgrrls.org [mailto:rxtx-bounces at mail.linuxgrrls.org] On Behalf Of Trent Jarvi Sent: Thursday, April 07, 2005 6:23 PM To: Java RXTX discussion Subject: Re: [Rxtx] Input/output error in writeArray On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a > Windows box. Everything connects up fine, and I can send and receive > a simple sequence of bytes with no problems. However, if around 5 > seconds goes by without me sending something, I get the following when > I attempt to send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at mail.linuxgrrls.org http://mail.linuxgrrls.org/mailman/listinfo/rxtx From ricardo.trindade at emation.pt Mon Apr 4 09:17:23 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Mon, 04 Apr 2005 16:17:23 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot Message-ID: <42515A83.4050907@emation.pt> Hi, I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most recent stable snapshot), and get the following exception : It looks like rxtx has been compiled with jdk 1.5. If this was indeed the case, I think there is a compilation flag that generates code that runs on older jdks. java.lang.UnsupportedClassVersionError: gnu/io/UnsupportedCommOperationException (Unsupported major.minor version 49.0) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at java.net.URLClassLoader.defineClass(URLClassLoader.java:251) at java.net.URLClassLoader.access$100(URLClassLoader.java:55) at java.net.URLClassLoader$1.run(URLClassLoader.java:194) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:187) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:141) I'm trying to run it with 1.4. thanks Ricardo From taj at www.linux.org.uk Tue Apr 5 00:48:12 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 07:48:12 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42515A83.4050907@emation.pt> References: <42515A83.4050907@emation.pt> Message-ID: On Mon, 4 Apr 2005, Ricardo Trindade wrote: > Hi, > > I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most > recent stable snapshot), and get the following exception : > > It looks like rxtx has been compiled with jdk 1.5. If this was > indeed the case, I think there is a compilation flag that generates code > that runs on older jdks. > > java.lang.UnsupportedClassVersionError: > gnu/io/UnsupportedCommOperationException (Unsupported major.minor > version 49.0) [snip] Thanks Ricardo I recompiled the jar with javac -source 1.3 -target 1.3. That should cover most of the JRE's in use today. I also compiled the rxtx 2.0 x86_64 native library which appeared to be missing. I tried looking for flags to pass gcc 4.0 to make the native libraries more backwards compatible but only found options for C++ which is not used in rxtx. I've got a list of other bugs that I'll be going through in the next few weeks but for now I just left them with the same CVS filename - no code changes. ftp://ftp.qbang.org/pub/rxtx/rxtx-2.0-CVS-20050120-bins.tar.gz ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-CVS-20050120-bins.tar.gz -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Tue Apr 5 02:24:33 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 05 Apr 2005 09:24:33 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: References: <42515A83.4050907@emation.pt> Message-ID: <42524B41.3040300@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050405/5919abbb/attachment-0120.html From taj at www.linux.org.uk Tue Apr 5 03:00:29 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 10:00:29 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42524B41.3040300@emation.pt> References: <42515A83.4050907@emation.pt> <42524B41.3040300@emation.pt> Message-ID: On Tue, 5 Apr 2005, Ricardo Trindade wrote: > Will you anounce to the list when a new release is available ? > There will be several incremental releases announced here. Once those are done, we will release 2.1.7 and 2.0.7. -- Trent Jarvi taj at www.linux.org.uk From no_spam at somewhere.com Tue Apr 5 11:55:37 2005 From: no_spam at somewhere.com (no_spam@somewhere.com) Date: Tue, 5 Apr 2005 13:55:37 -0400 Subject: [Rxtx] Closing a port from an event listener results in a deadlock Message-ID: <20050405175537.GA21747@rcog.homelinux.net> On the message I sent on March 14, does anyone had the chance to try the modification? Or was it already fixed? (I haven't searched the archive extensively) Or maybe my message got catched by some spam filters? (it made it to the list archive though) Anyway, I would appreciate some feedback (through the list) Thanks From taj at www.linux.org.uk Tue Apr 5 14:42:28 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 21:42:28 +0100 (BST) Subject: [Rxtx] Closing a port from an event listener results in a deadlock In-Reply-To: <20050405175537.GA21747@rcog.homelinux.net> References: <20050405175537.GA21747@rcog.homelinux.net> Message-ID: On Tue, 5 Apr 2005 no_spam at somewhere.com wrote: > On the message I sent on March 14, does anyone had the chance to try the > modification? > > Or was it already fixed? (I haven't searched the archive extensively) > > Or maybe my message got catched by some spam filters? (it made it to the list > archive though) > > Anyway, I would appreciate some feedback (through the list) > The patch is here http://marc.theaimsgroup.com/?l=rxtx&m=111084488820288&w=2 I have applied this patch to a local copy but will not be doing formal testing for a couple weeks. I do not try to close ports from inside the eventListenter usually so I encourage any feedback also. If there are no problems reported, I expect this will go into rxtx 2.1-7. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Wed Apr 6 08:33:42 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Wed, 06 Apr 2005 15:33:42 +0100 Subject: [Rxtx] getting RXTX version Message-ID: <4253F346.50102@emation.pt> Hi, I want to make sure my deployments have the same version of RXTX jar and native lib. I know the version of the jar can be obtained in the Version class, but how can I obtain the native version ? I know RXTX prints to the console a warning if the version is different. Is there a way to programatically know is this is the case ? I would like to log that to our app's log thanks Ricardo From taj at www.linux.org.uk Wed Apr 6 15:10:20 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 6 Apr 2005 22:10:20 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4253F346.50102@emation.pt> References: <4253F346.50102@emation.pt> Message-ID: On Wed, 6 Apr 2005, Ricardo Trindade wrote: > Hi, > > I want to make sure my deployments have the same version of RXTX jar > and native lib. > > I know the version of the jar can be obtained in the Version class, > but how can I obtain the native version ? > > I know RXTX prints to the console a warning if the version is > different. Is there a way to programatically know is this is the case ? > > I would like to log that to our app's log > There isn't a suggested way of doing that right now. We could move things around and have a static String RXTXVersion.getNativeVersion() in future releases. Is this what you expected? This is not documented in commapi at all. I just tossed that in to catch conflicts while developing. It would be nice to have access in GUI applications though. It may be possible to access RXTXCommDriver.LibVersion right now. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Thu Apr 7 02:51:00 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 09:51:00 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> Message-ID: <4254F474.7020905@emation.pt> >There isn't a suggested way of doing that right now. We could move things >around and have a static String RXTXVersion.getNativeVersion() in future >releases. Is this what you expected? > > Yes, that would be perfect. >This is not documented in commapi at all. I just tossed that in to catch >conflicts while developing. It would be nice to have access in GUI >applications though. > >It may be possible to access RXTXCommDriver.LibVersion right now. > > > I tried, and I don't think it's possible. From taj at www.linux.org.uk Thu Apr 7 03:32:04 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 7 Apr 2005 10:32:04 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4254F474.7020905@emation.pt> References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: On Thu, 7 Apr 2005, Ricardo Trindade wrote: > > >There isn't a suggested way of doing that right now. We could move things > >around and have a static String RXTXVersion.getNativeVersion() in future > >releases. Is this what you expected? > > > > > > Yes, that would be perfect. > The attached should do what you want. You will still need to catch an exception for older versions... -- Trent Jarvi taj at www.linux.org.uk -------------- next part -------------- ? public_version.patch Index: RXTXCommDriver.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXCommDriver.java,v retrieving revision 1.16.2.51 diff -u -r1.16.2.51 RXTXCommDriver.java --- RXTXCommDriver.java 12 Oct 2004 09:13:30 -0000 1.16.2.51 +++ RXTXCommDriver.java 7 Apr 2005 09:29:04 -0000 @@ -54,7 +54,7 @@ the Library. */ String JarVersion = RXTXVersion.getVersion(); - String LibVersion = nativeGetVersion(); + String LibVersion = RXTXVersion.nativeGetVersion(); if ( devel ) { System.out.println("Devel Library"); @@ -76,7 +76,6 @@ /** Get the Serial port prefixes for the running OS */ private String deviceDirectory; private String osName; - private static native String nativeGetVersion(); private native boolean registerKnownPorts(int PortType); private native boolean isPortPrefixValid(String dev); private native boolean testRead(String dev, int type); Index: RXTXVersion.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXVersion.java,v retrieving revision 1.2.2.31 diff -u -r1.2.2.31 RXTXVersion.java --- RXTXVersion.java 16 Oct 2004 16:20:35 -0000 1.2.2.31 +++ RXTXVersion.java 7 Apr 2005 09:29:04 -0000 @@ -36,6 +36,7 @@ private static String Version; static { + System.loadLibrary( "rxtxSerial" ); Version = "RXTX-2.1-7pre20"; } /** @@ -47,4 +48,5 @@ { return(Version); } + public static native String nativeGetVersion(); } Index: SerialImp.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v retrieving revision 1.46.2.181 diff -u -r1.46.2.181 SerialImp.c --- SerialImp.c 17 Oct 2004 09:48:56 -0000 1.46.2.181 +++ SerialImp.c 7 Apr 2005 09:29:07 -0000 @@ -116,6 +116,7 @@ * It will eventually be removed. * */ #define RXTXPort(foo) Java_gnu_io_RXTXPort_ ## foo +#define RXTXVersion(foo) Java_gnu_io_RXTXVersion_ ## foo #define RXTXCommDriver(foo) Java_gnu_io_RXTXCommDriver_ ## foo #if defined(__sun__) || defined(__hpux__) @@ -4001,7 +4002,7 @@ } /*---------------------------------------------------------- -RXTXCommDriver.nativeGetVersion +RXTXVersion.nativeGetVersion accept: none perform: return the current version @@ -4010,9 +4011,10 @@ comments: This is used to avoid mixing versions of the .jar and native library. First introduced in rxtx-1.5-9 + Moved from RXTXCommDriver to RXTXVersion in rxtx-2.1-7 ----------------------------------------------------------*/ -JNIEXPORT jstring JNICALL RXTXCommDriver(nativeGetVersion) (JNIEnv *env, +JNIEXPORT jstring JNICALL RXTXVersion(nativeGetVersion) (JNIEnv *env, jclass jclazz ) { return (*env)->NewStringUTF( env, "RXTX-2.1-7pre20" ); From ricardo.trindade at emation.pt Thu Apr 7 03:45:58 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 10:45:58 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: <42550156.2040908@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050407/05212451/attachment-0120.html From thomas.shulok at lmco.com Thu Apr 7 17:43:11 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Thu, 07 Apr 2005 19:43:11 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi There, I'm attempting to talk RS232 between an embedded Linux box and a Windows box. Everything connects up fine, and I can send and receive a simple sequence of bytes with no problems. However, if around 5 seconds goes by without me sending something, I get the following when I attempt to send. java.io.IOException: Input/output error in writeArray Stack trace: java/lang/Throwable.()V java/lang/Throwable.(Ljava/lang/String;)V java/io/IOException.(Ljava/lang/String;)V gnu/io/RXTXPort.writeArray([BIIZ)V gnu/io/RXTXPort$SerialOutputStream.write([B)V SerialTest.main([Ljava/lang/String;)V If there interval is shorter (say 2 seconds between sends), I have no problems. On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and librxtxSerial-2.0.7pre2.so. Any ideas? Thanks, Thom -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5b23dcf/attachment-0120.html From taj at www.linux.org.uk Thu Apr 7 19:22:36 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:22:36 +0100 (BST) Subject: [Rxtx] Input/output error in writeArray In-Reply-To: References: Message-ID: On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a Windows > box. Everything connects up fine, and I can send and receive a simple > sequence of bytes with no problems. However, if around 5 seconds goes > by without me sending something, I get the following when I attempt to > send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Apr 7 19:24:59 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:24:59 +0100 (BST) Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) Message-ID: hmm. This would not work from applets would it? -- Trent Jarvi taj at www.linux.org.uk ---------- Forwarded message ---------- Date: Thu, 07 Apr 2005 16:05:53 -0400 From: Chris Gaffney To: taj at www.linux.org.uk Subject: RXTX Libraries on Classpath fix Hi, I submitted a patch for RXTX a few weeks ago to allow for loading the native libraries from the classpath. Since sending it to you I found it wasn't working on windows. I've fixed the problem and created a new patch that should replace the older one. The actual change is a one line from a String.equals() to a String.startsWith(). Thanks for a great piece of software, -Chris Gaffney Grand Valley State University -------------- next part -------------- A non-text attachment was scrubbed... Name: libraries_on_classpath_fixed.patch Type: text/x-patch Size: 5617 bytes Desc: Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5d423b8/libraries_on_classpath_fixed-0120.bin From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From thomas.shulok at lmco.com Fri Apr 8 10:38:55 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Fri, 08 Apr 2005 12:38:55 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi Trent, Thanks for the prompt response. Before diving deeper, I was wondering if there is a timeout parameter somewhere in the stack that I have not set properly. Given the nature of the failure (only fails if the line has been idle for a few seconds), it feels like some kind of timeout issue... Thanks again, Thom -----Original Message----- From: rxtx-bounces at mail.linuxgrrls.org [mailto:rxtx-bounces at mail.linuxgrrls.org] On Behalf Of Trent Jarvi Sent: Thursday, April 07, 2005 6:23 PM To: Java RXTX discussion Subject: Re: [Rxtx] Input/output error in writeArray On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a > Windows box. Everything connects up fine, and I can send and receive > a simple sequence of bytes with no problems. However, if around 5 > seconds goes by without me sending something, I get the following when > I attempt to send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at mail.linuxgrrls.org http://mail.linuxgrrls.org/mailman/listinfo/rxtx From ricardo.trindade at emation.pt Mon Apr 4 09:17:23 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Mon, 04 Apr 2005 16:17:23 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot Message-ID: <42515A83.4050907@emation.pt> Hi, I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most recent stable snapshot), and get the following exception : It looks like rxtx has been compiled with jdk 1.5. If this was indeed the case, I think there is a compilation flag that generates code that runs on older jdks. java.lang.UnsupportedClassVersionError: gnu/io/UnsupportedCommOperationException (Unsupported major.minor version 49.0) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at java.net.URLClassLoader.defineClass(URLClassLoader.java:251) at java.net.URLClassLoader.access$100(URLClassLoader.java:55) at java.net.URLClassLoader$1.run(URLClassLoader.java:194) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:187) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:141) I'm trying to run it with 1.4. thanks Ricardo From taj at www.linux.org.uk Tue Apr 5 00:48:12 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 07:48:12 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42515A83.4050907@emation.pt> References: <42515A83.4050907@emation.pt> Message-ID: On Mon, 4 Apr 2005, Ricardo Trindade wrote: > Hi, > > I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most > recent stable snapshot), and get the following exception : > > It looks like rxtx has been compiled with jdk 1.5. If this was > indeed the case, I think there is a compilation flag that generates code > that runs on older jdks. > > java.lang.UnsupportedClassVersionError: > gnu/io/UnsupportedCommOperationException (Unsupported major.minor > version 49.0) [snip] Thanks Ricardo I recompiled the jar with javac -source 1.3 -target 1.3. That should cover most of the JRE's in use today. I also compiled the rxtx 2.0 x86_64 native library which appeared to be missing. I tried looking for flags to pass gcc 4.0 to make the native libraries more backwards compatible but only found options for C++ which is not used in rxtx. I've got a list of other bugs that I'll be going through in the next few weeks but for now I just left them with the same CVS filename - no code changes. ftp://ftp.qbang.org/pub/rxtx/rxtx-2.0-CVS-20050120-bins.tar.gz ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-CVS-20050120-bins.tar.gz -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Tue Apr 5 02:24:33 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 05 Apr 2005 09:24:33 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: References: <42515A83.4050907@emation.pt> Message-ID: <42524B41.3040300@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050405/5919abbb/attachment-0121.html From taj at www.linux.org.uk Tue Apr 5 03:00:29 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 10:00:29 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42524B41.3040300@emation.pt> References: <42515A83.4050907@emation.pt> <42524B41.3040300@emation.pt> Message-ID: On Tue, 5 Apr 2005, Ricardo Trindade wrote: > Will you anounce to the list when a new release is available ? > There will be several incremental releases announced here. Once those are done, we will release 2.1.7 and 2.0.7. -- Trent Jarvi taj at www.linux.org.uk From no_spam at somewhere.com Tue Apr 5 11:55:37 2005 From: no_spam at somewhere.com (no_spam@somewhere.com) Date: Tue, 5 Apr 2005 13:55:37 -0400 Subject: [Rxtx] Closing a port from an event listener results in a deadlock Message-ID: <20050405175537.GA21747@rcog.homelinux.net> On the message I sent on March 14, does anyone had the chance to try the modification? Or was it already fixed? (I haven't searched the archive extensively) Or maybe my message got catched by some spam filters? (it made it to the list archive though) Anyway, I would appreciate some feedback (through the list) Thanks From taj at www.linux.org.uk Tue Apr 5 14:42:28 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 21:42:28 +0100 (BST) Subject: [Rxtx] Closing a port from an event listener results in a deadlock In-Reply-To: <20050405175537.GA21747@rcog.homelinux.net> References: <20050405175537.GA21747@rcog.homelinux.net> Message-ID: On Tue, 5 Apr 2005 no_spam at somewhere.com wrote: > On the message I sent on March 14, does anyone had the chance to try the > modification? > > Or was it already fixed? (I haven't searched the archive extensively) > > Or maybe my message got catched by some spam filters? (it made it to the list > archive though) > > Anyway, I would appreciate some feedback (through the list) > The patch is here http://marc.theaimsgroup.com/?l=rxtx&m=111084488820288&w=2 I have applied this patch to a local copy but will not be doing formal testing for a couple weeks. I do not try to close ports from inside the eventListenter usually so I encourage any feedback also. If there are no problems reported, I expect this will go into rxtx 2.1-7. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Wed Apr 6 08:33:42 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Wed, 06 Apr 2005 15:33:42 +0100 Subject: [Rxtx] getting RXTX version Message-ID: <4253F346.50102@emation.pt> Hi, I want to make sure my deployments have the same version of RXTX jar and native lib. I know the version of the jar can be obtained in the Version class, but how can I obtain the native version ? I know RXTX prints to the console a warning if the version is different. Is there a way to programatically know is this is the case ? I would like to log that to our app's log thanks Ricardo From taj at www.linux.org.uk Wed Apr 6 15:10:20 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 6 Apr 2005 22:10:20 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4253F346.50102@emation.pt> References: <4253F346.50102@emation.pt> Message-ID: On Wed, 6 Apr 2005, Ricardo Trindade wrote: > Hi, > > I want to make sure my deployments have the same version of RXTX jar > and native lib. > > I know the version of the jar can be obtained in the Version class, > but how can I obtain the native version ? > > I know RXTX prints to the console a warning if the version is > different. Is there a way to programatically know is this is the case ? > > I would like to log that to our app's log > There isn't a suggested way of doing that right now. We could move things around and have a static String RXTXVersion.getNativeVersion() in future releases. Is this what you expected? This is not documented in commapi at all. I just tossed that in to catch conflicts while developing. It would be nice to have access in GUI applications though. It may be possible to access RXTXCommDriver.LibVersion right now. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Thu Apr 7 02:51:00 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 09:51:00 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> Message-ID: <4254F474.7020905@emation.pt> >There isn't a suggested way of doing that right now. We could move things >around and have a static String RXTXVersion.getNativeVersion() in future >releases. Is this what you expected? > > Yes, that would be perfect. >This is not documented in commapi at all. I just tossed that in to catch >conflicts while developing. It would be nice to have access in GUI >applications though. > >It may be possible to access RXTXCommDriver.LibVersion right now. > > > I tried, and I don't think it's possible. From taj at www.linux.org.uk Thu Apr 7 03:32:04 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 7 Apr 2005 10:32:04 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4254F474.7020905@emation.pt> References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: On Thu, 7 Apr 2005, Ricardo Trindade wrote: > > >There isn't a suggested way of doing that right now. We could move things > >around and have a static String RXTXVersion.getNativeVersion() in future > >releases. Is this what you expected? > > > > > > Yes, that would be perfect. > The attached should do what you want. You will still need to catch an exception for older versions... -- Trent Jarvi taj at www.linux.org.uk -------------- next part -------------- ? public_version.patch Index: RXTXCommDriver.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXCommDriver.java,v retrieving revision 1.16.2.51 diff -u -r1.16.2.51 RXTXCommDriver.java --- RXTXCommDriver.java 12 Oct 2004 09:13:30 -0000 1.16.2.51 +++ RXTXCommDriver.java 7 Apr 2005 09:29:04 -0000 @@ -54,7 +54,7 @@ the Library. */ String JarVersion = RXTXVersion.getVersion(); - String LibVersion = nativeGetVersion(); + String LibVersion = RXTXVersion.nativeGetVersion(); if ( devel ) { System.out.println("Devel Library"); @@ -76,7 +76,6 @@ /** Get the Serial port prefixes for the running OS */ private String deviceDirectory; private String osName; - private static native String nativeGetVersion(); private native boolean registerKnownPorts(int PortType); private native boolean isPortPrefixValid(String dev); private native boolean testRead(String dev, int type); Index: RXTXVersion.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXVersion.java,v retrieving revision 1.2.2.31 diff -u -r1.2.2.31 RXTXVersion.java --- RXTXVersion.java 16 Oct 2004 16:20:35 -0000 1.2.2.31 +++ RXTXVersion.java 7 Apr 2005 09:29:04 -0000 @@ -36,6 +36,7 @@ private static String Version; static { + System.loadLibrary( "rxtxSerial" ); Version = "RXTX-2.1-7pre20"; } /** @@ -47,4 +48,5 @@ { return(Version); } + public static native String nativeGetVersion(); } Index: SerialImp.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v retrieving revision 1.46.2.181 diff -u -r1.46.2.181 SerialImp.c --- SerialImp.c 17 Oct 2004 09:48:56 -0000 1.46.2.181 +++ SerialImp.c 7 Apr 2005 09:29:07 -0000 @@ -116,6 +116,7 @@ * It will eventually be removed. * */ #define RXTXPort(foo) Java_gnu_io_RXTXPort_ ## foo +#define RXTXVersion(foo) Java_gnu_io_RXTXVersion_ ## foo #define RXTXCommDriver(foo) Java_gnu_io_RXTXCommDriver_ ## foo #if defined(__sun__) || defined(__hpux__) @@ -4001,7 +4002,7 @@ } /*---------------------------------------------------------- -RXTXCommDriver.nativeGetVersion +RXTXVersion.nativeGetVersion accept: none perform: return the current version @@ -4010,9 +4011,10 @@ comments: This is used to avoid mixing versions of the .jar and native library. First introduced in rxtx-1.5-9 + Moved from RXTXCommDriver to RXTXVersion in rxtx-2.1-7 ----------------------------------------------------------*/ -JNIEXPORT jstring JNICALL RXTXCommDriver(nativeGetVersion) (JNIEnv *env, +JNIEXPORT jstring JNICALL RXTXVersion(nativeGetVersion) (JNIEnv *env, jclass jclazz ) { return (*env)->NewStringUTF( env, "RXTX-2.1-7pre20" ); From ricardo.trindade at emation.pt Thu Apr 7 03:45:58 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 10:45:58 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: <42550156.2040908@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050407/05212451/attachment-0121.html From thomas.shulok at lmco.com Thu Apr 7 17:43:11 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Thu, 07 Apr 2005 19:43:11 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi There, I'm attempting to talk RS232 between an embedded Linux box and a Windows box. Everything connects up fine, and I can send and receive a simple sequence of bytes with no problems. However, if around 5 seconds goes by without me sending something, I get the following when I attempt to send. java.io.IOException: Input/output error in writeArray Stack trace: java/lang/Throwable.()V java/lang/Throwable.(Ljava/lang/String;)V java/io/IOException.(Ljava/lang/String;)V gnu/io/RXTXPort.writeArray([BIIZ)V gnu/io/RXTXPort$SerialOutputStream.write([B)V SerialTest.main([Ljava/lang/String;)V If there interval is shorter (say 2 seconds between sends), I have no problems. On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and librxtxSerial-2.0.7pre2.so. Any ideas? Thanks, Thom -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5b23dcf/attachment-0121.html From taj at www.linux.org.uk Thu Apr 7 19:22:36 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:22:36 +0100 (BST) Subject: [Rxtx] Input/output error in writeArray In-Reply-To: References: Message-ID: On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a Windows > box. Everything connects up fine, and I can send and receive a simple > sequence of bytes with no problems. However, if around 5 seconds goes > by without me sending something, I get the following when I attempt to > send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Apr 7 19:24:59 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:24:59 +0100 (BST) Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) Message-ID: hmm. This would not work from applets would it? -- Trent Jarvi taj at www.linux.org.uk ---------- Forwarded message ---------- Date: Thu, 07 Apr 2005 16:05:53 -0400 From: Chris Gaffney To: taj at www.linux.org.uk Subject: RXTX Libraries on Classpath fix Hi, I submitted a patch for RXTX a few weeks ago to allow for loading the native libraries from the classpath. Since sending it to you I found it wasn't working on windows. I've fixed the problem and created a new patch that should replace the older one. The actual change is a one line from a String.equals() to a String.startsWith(). Thanks for a great piece of software, -Chris Gaffney Grand Valley State University -------------- next part -------------- A non-text attachment was scrubbed... Name: libraries_on_classpath_fixed.patch Type: text/x-patch Size: 5617 bytes Desc: Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5d423b8/libraries_on_classpath_fixed-0121.bin From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From thomas.shulok at lmco.com Fri Apr 8 10:38:55 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Fri, 08 Apr 2005 12:38:55 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi Trent, Thanks for the prompt response. Before diving deeper, I was wondering if there is a timeout parameter somewhere in the stack that I have not set properly. Given the nature of the failure (only fails if the line has been idle for a few seconds), it feels like some kind of timeout issue... Thanks again, Thom -----Original Message----- From: rxtx-bounces at mail.linuxgrrls.org [mailto:rxtx-bounces at mail.linuxgrrls.org] On Behalf Of Trent Jarvi Sent: Thursday, April 07, 2005 6:23 PM To: Java RXTX discussion Subject: Re: [Rxtx] Input/output error in writeArray On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a > Windows box. Everything connects up fine, and I can send and receive > a simple sequence of bytes with no problems. However, if around 5 > seconds goes by without me sending something, I get the following when > I attempt to send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at mail.linuxgrrls.org http://mail.linuxgrrls.org/mailman/listinfo/rxtx From ricardo.trindade at emation.pt Mon Apr 4 09:17:23 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Mon, 04 Apr 2005 16:17:23 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot Message-ID: <42515A83.4050907@emation.pt> Hi, I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most recent stable snapshot), and get the following exception : It looks like rxtx has been compiled with jdk 1.5. If this was indeed the case, I think there is a compilation flag that generates code that runs on older jdks. java.lang.UnsupportedClassVersionError: gnu/io/UnsupportedCommOperationException (Unsupported major.minor version 49.0) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at java.net.URLClassLoader.defineClass(URLClassLoader.java:251) at java.net.URLClassLoader.access$100(URLClassLoader.java:55) at java.net.URLClassLoader$1.run(URLClassLoader.java:194) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:187) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:141) I'm trying to run it with 1.4. thanks Ricardo From taj at www.linux.org.uk Tue Apr 5 00:48:12 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 07:48:12 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42515A83.4050907@emation.pt> References: <42515A83.4050907@emation.pt> Message-ID: On Mon, 4 Apr 2005, Ricardo Trindade wrote: > Hi, > > I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most > recent stable snapshot), and get the following exception : > > It looks like rxtx has been compiled with jdk 1.5. If this was > indeed the case, I think there is a compilation flag that generates code > that runs on older jdks. > > java.lang.UnsupportedClassVersionError: > gnu/io/UnsupportedCommOperationException (Unsupported major.minor > version 49.0) [snip] Thanks Ricardo I recompiled the jar with javac -source 1.3 -target 1.3. That should cover most of the JRE's in use today. I also compiled the rxtx 2.0 x86_64 native library which appeared to be missing. I tried looking for flags to pass gcc 4.0 to make the native libraries more backwards compatible but only found options for C++ which is not used in rxtx. I've got a list of other bugs that I'll be going through in the next few weeks but for now I just left them with the same CVS filename - no code changes. ftp://ftp.qbang.org/pub/rxtx/rxtx-2.0-CVS-20050120-bins.tar.gz ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-CVS-20050120-bins.tar.gz -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Tue Apr 5 02:24:33 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 05 Apr 2005 09:24:33 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: References: <42515A83.4050907@emation.pt> Message-ID: <42524B41.3040300@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050405/5919abbb/attachment-0122.html From taj at www.linux.org.uk Tue Apr 5 03:00:29 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 10:00:29 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42524B41.3040300@emation.pt> References: <42515A83.4050907@emation.pt> <42524B41.3040300@emation.pt> Message-ID: On Tue, 5 Apr 2005, Ricardo Trindade wrote: > Will you anounce to the list when a new release is available ? > There will be several incremental releases announced here. Once those are done, we will release 2.1.7 and 2.0.7. -- Trent Jarvi taj at www.linux.org.uk From no_spam at somewhere.com Tue Apr 5 11:55:37 2005 From: no_spam at somewhere.com (no_spam@somewhere.com) Date: Tue, 5 Apr 2005 13:55:37 -0400 Subject: [Rxtx] Closing a port from an event listener results in a deadlock Message-ID: <20050405175537.GA21747@rcog.homelinux.net> On the message I sent on March 14, does anyone had the chance to try the modification? Or was it already fixed? (I haven't searched the archive extensively) Or maybe my message got catched by some spam filters? (it made it to the list archive though) Anyway, I would appreciate some feedback (through the list) Thanks From taj at www.linux.org.uk Tue Apr 5 14:42:28 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 21:42:28 +0100 (BST) Subject: [Rxtx] Closing a port from an event listener results in a deadlock In-Reply-To: <20050405175537.GA21747@rcog.homelinux.net> References: <20050405175537.GA21747@rcog.homelinux.net> Message-ID: On Tue, 5 Apr 2005 no_spam at somewhere.com wrote: > On the message I sent on March 14, does anyone had the chance to try the > modification? > > Or was it already fixed? (I haven't searched the archive extensively) > > Or maybe my message got catched by some spam filters? (it made it to the list > archive though) > > Anyway, I would appreciate some feedback (through the list) > The patch is here http://marc.theaimsgroup.com/?l=rxtx&m=111084488820288&w=2 I have applied this patch to a local copy but will not be doing formal testing for a couple weeks. I do not try to close ports from inside the eventListenter usually so I encourage any feedback also. If there are no problems reported, I expect this will go into rxtx 2.1-7. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Wed Apr 6 08:33:42 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Wed, 06 Apr 2005 15:33:42 +0100 Subject: [Rxtx] getting RXTX version Message-ID: <4253F346.50102@emation.pt> Hi, I want to make sure my deployments have the same version of RXTX jar and native lib. I know the version of the jar can be obtained in the Version class, but how can I obtain the native version ? I know RXTX prints to the console a warning if the version is different. Is there a way to programatically know is this is the case ? I would like to log that to our app's log thanks Ricardo From taj at www.linux.org.uk Wed Apr 6 15:10:20 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 6 Apr 2005 22:10:20 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4253F346.50102@emation.pt> References: <4253F346.50102@emation.pt> Message-ID: On Wed, 6 Apr 2005, Ricardo Trindade wrote: > Hi, > > I want to make sure my deployments have the same version of RXTX jar > and native lib. > > I know the version of the jar can be obtained in the Version class, > but how can I obtain the native version ? > > I know RXTX prints to the console a warning if the version is > different. Is there a way to programatically know is this is the case ? > > I would like to log that to our app's log > There isn't a suggested way of doing that right now. We could move things around and have a static String RXTXVersion.getNativeVersion() in future releases. Is this what you expected? This is not documented in commapi at all. I just tossed that in to catch conflicts while developing. It would be nice to have access in GUI applications though. It may be possible to access RXTXCommDriver.LibVersion right now. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Thu Apr 7 02:51:00 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 09:51:00 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> Message-ID: <4254F474.7020905@emation.pt> >There isn't a suggested way of doing that right now. We could move things >around and have a static String RXTXVersion.getNativeVersion() in future >releases. Is this what you expected? > > Yes, that would be perfect. >This is not documented in commapi at all. I just tossed that in to catch >conflicts while developing. It would be nice to have access in GUI >applications though. > >It may be possible to access RXTXCommDriver.LibVersion right now. > > > I tried, and I don't think it's possible. From taj at www.linux.org.uk Thu Apr 7 03:32:04 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 7 Apr 2005 10:32:04 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4254F474.7020905@emation.pt> References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: On Thu, 7 Apr 2005, Ricardo Trindade wrote: > > >There isn't a suggested way of doing that right now. We could move things > >around and have a static String RXTXVersion.getNativeVersion() in future > >releases. Is this what you expected? > > > > > > Yes, that would be perfect. > The attached should do what you want. You will still need to catch an exception for older versions... -- Trent Jarvi taj at www.linux.org.uk -------------- next part -------------- ? public_version.patch Index: RXTXCommDriver.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXCommDriver.java,v retrieving revision 1.16.2.51 diff -u -r1.16.2.51 RXTXCommDriver.java --- RXTXCommDriver.java 12 Oct 2004 09:13:30 -0000 1.16.2.51 +++ RXTXCommDriver.java 7 Apr 2005 09:29:04 -0000 @@ -54,7 +54,7 @@ the Library. */ String JarVersion = RXTXVersion.getVersion(); - String LibVersion = nativeGetVersion(); + String LibVersion = RXTXVersion.nativeGetVersion(); if ( devel ) { System.out.println("Devel Library"); @@ -76,7 +76,6 @@ /** Get the Serial port prefixes for the running OS */ private String deviceDirectory; private String osName; - private static native String nativeGetVersion(); private native boolean registerKnownPorts(int PortType); private native boolean isPortPrefixValid(String dev); private native boolean testRead(String dev, int type); Index: RXTXVersion.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXVersion.java,v retrieving revision 1.2.2.31 diff -u -r1.2.2.31 RXTXVersion.java --- RXTXVersion.java 16 Oct 2004 16:20:35 -0000 1.2.2.31 +++ RXTXVersion.java 7 Apr 2005 09:29:04 -0000 @@ -36,6 +36,7 @@ private static String Version; static { + System.loadLibrary( "rxtxSerial" ); Version = "RXTX-2.1-7pre20"; } /** @@ -47,4 +48,5 @@ { return(Version); } + public static native String nativeGetVersion(); } Index: SerialImp.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v retrieving revision 1.46.2.181 diff -u -r1.46.2.181 SerialImp.c --- SerialImp.c 17 Oct 2004 09:48:56 -0000 1.46.2.181 +++ SerialImp.c 7 Apr 2005 09:29:07 -0000 @@ -116,6 +116,7 @@ * It will eventually be removed. * */ #define RXTXPort(foo) Java_gnu_io_RXTXPort_ ## foo +#define RXTXVersion(foo) Java_gnu_io_RXTXVersion_ ## foo #define RXTXCommDriver(foo) Java_gnu_io_RXTXCommDriver_ ## foo #if defined(__sun__) || defined(__hpux__) @@ -4001,7 +4002,7 @@ } /*---------------------------------------------------------- -RXTXCommDriver.nativeGetVersion +RXTXVersion.nativeGetVersion accept: none perform: return the current version @@ -4010,9 +4011,10 @@ comments: This is used to avoid mixing versions of the .jar and native library. First introduced in rxtx-1.5-9 + Moved from RXTXCommDriver to RXTXVersion in rxtx-2.1-7 ----------------------------------------------------------*/ -JNIEXPORT jstring JNICALL RXTXCommDriver(nativeGetVersion) (JNIEnv *env, +JNIEXPORT jstring JNICALL RXTXVersion(nativeGetVersion) (JNIEnv *env, jclass jclazz ) { return (*env)->NewStringUTF( env, "RXTX-2.1-7pre20" ); From ricardo.trindade at emation.pt Thu Apr 7 03:45:58 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 10:45:58 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: <42550156.2040908@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050407/05212451/attachment-0122.html From thomas.shulok at lmco.com Thu Apr 7 17:43:11 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Thu, 07 Apr 2005 19:43:11 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi There, I'm attempting to talk RS232 between an embedded Linux box and a Windows box. Everything connects up fine, and I can send and receive a simple sequence of bytes with no problems. However, if around 5 seconds goes by without me sending something, I get the following when I attempt to send. java.io.IOException: Input/output error in writeArray Stack trace: java/lang/Throwable.()V java/lang/Throwable.(Ljava/lang/String;)V java/io/IOException.(Ljava/lang/String;)V gnu/io/RXTXPort.writeArray([BIIZ)V gnu/io/RXTXPort$SerialOutputStream.write([B)V SerialTest.main([Ljava/lang/String;)V If there interval is shorter (say 2 seconds between sends), I have no problems. On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and librxtxSerial-2.0.7pre2.so. Any ideas? Thanks, Thom -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5b23dcf/attachment-0122.html From taj at www.linux.org.uk Thu Apr 7 19:22:36 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:22:36 +0100 (BST) Subject: [Rxtx] Input/output error in writeArray In-Reply-To: References: Message-ID: On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a Windows > box. Everything connects up fine, and I can send and receive a simple > sequence of bytes with no problems. However, if around 5 seconds goes > by without me sending something, I get the following when I attempt to > send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Apr 7 19:24:59 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:24:59 +0100 (BST) Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) Message-ID: hmm. This would not work from applets would it? -- Trent Jarvi taj at www.linux.org.uk ---------- Forwarded message ---------- Date: Thu, 07 Apr 2005 16:05:53 -0400 From: Chris Gaffney To: taj at www.linux.org.uk Subject: RXTX Libraries on Classpath fix Hi, I submitted a patch for RXTX a few weeks ago to allow for loading the native libraries from the classpath. Since sending it to you I found it wasn't working on windows. I've fixed the problem and created a new patch that should replace the older one. The actual change is a one line from a String.equals() to a String.startsWith(). Thanks for a great piece of software, -Chris Gaffney Grand Valley State University -------------- next part -------------- A non-text attachment was scrubbed... Name: libraries_on_classpath_fixed.patch Type: text/x-patch Size: 5617 bytes Desc: Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5d423b8/libraries_on_classpath_fixed-0122.bin From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From thomas.shulok at lmco.com Fri Apr 8 10:38:55 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Fri, 08 Apr 2005 12:38:55 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi Trent, Thanks for the prompt response. Before diving deeper, I was wondering if there is a timeout parameter somewhere in the stack that I have not set properly. Given the nature of the failure (only fails if the line has been idle for a few seconds), it feels like some kind of timeout issue... Thanks again, Thom -----Original Message----- From: rxtx-bounces at mail.linuxgrrls.org [mailto:rxtx-bounces at mail.linuxgrrls.org] On Behalf Of Trent Jarvi Sent: Thursday, April 07, 2005 6:23 PM To: Java RXTX discussion Subject: Re: [Rxtx] Input/output error in writeArray On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a > Windows box. Everything connects up fine, and I can send and receive > a simple sequence of bytes with no problems. However, if around 5 > seconds goes by without me sending something, I get the following when > I attempt to send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at mail.linuxgrrls.org http://mail.linuxgrrls.org/mailman/listinfo/rxtx From ricardo.trindade at emation.pt Mon Apr 4 09:17:23 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Mon, 04 Apr 2005 16:17:23 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot Message-ID: <42515A83.4050907@emation.pt> Hi, I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most recent stable snapshot), and get the following exception : It looks like rxtx has been compiled with jdk 1.5. If this was indeed the case, I think there is a compilation flag that generates code that runs on older jdks. java.lang.UnsupportedClassVersionError: gnu/io/UnsupportedCommOperationException (Unsupported major.minor version 49.0) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at java.net.URLClassLoader.defineClass(URLClassLoader.java:251) at java.net.URLClassLoader.access$100(URLClassLoader.java:55) at java.net.URLClassLoader$1.run(URLClassLoader.java:194) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:187) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:141) I'm trying to run it with 1.4. thanks Ricardo From taj at www.linux.org.uk Tue Apr 5 00:48:12 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 07:48:12 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42515A83.4050907@emation.pt> References: <42515A83.4050907@emation.pt> Message-ID: On Mon, 4 Apr 2005, Ricardo Trindade wrote: > Hi, > > I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most > recent stable snapshot), and get the following exception : > > It looks like rxtx has been compiled with jdk 1.5. If this was > indeed the case, I think there is a compilation flag that generates code > that runs on older jdks. > > java.lang.UnsupportedClassVersionError: > gnu/io/UnsupportedCommOperationException (Unsupported major.minor > version 49.0) [snip] Thanks Ricardo I recompiled the jar with javac -source 1.3 -target 1.3. That should cover most of the JRE's in use today. I also compiled the rxtx 2.0 x86_64 native library which appeared to be missing. I tried looking for flags to pass gcc 4.0 to make the native libraries more backwards compatible but only found options for C++ which is not used in rxtx. I've got a list of other bugs that I'll be going through in the next few weeks but for now I just left them with the same CVS filename - no code changes. ftp://ftp.qbang.org/pub/rxtx/rxtx-2.0-CVS-20050120-bins.tar.gz ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-CVS-20050120-bins.tar.gz -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Tue Apr 5 02:24:33 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 05 Apr 2005 09:24:33 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: References: <42515A83.4050907@emation.pt> Message-ID: <42524B41.3040300@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050405/5919abbb/attachment-0123.html From taj at www.linux.org.uk Tue Apr 5 03:00:29 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 10:00:29 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42524B41.3040300@emation.pt> References: <42515A83.4050907@emation.pt> <42524B41.3040300@emation.pt> Message-ID: On Tue, 5 Apr 2005, Ricardo Trindade wrote: > Will you anounce to the list when a new release is available ? > There will be several incremental releases announced here. Once those are done, we will release 2.1.7 and 2.0.7. -- Trent Jarvi taj at www.linux.org.uk From no_spam at somewhere.com Tue Apr 5 11:55:37 2005 From: no_spam at somewhere.com (no_spam@somewhere.com) Date: Tue, 5 Apr 2005 13:55:37 -0400 Subject: [Rxtx] Closing a port from an event listener results in a deadlock Message-ID: <20050405175537.GA21747@rcog.homelinux.net> On the message I sent on March 14, does anyone had the chance to try the modification? Or was it already fixed? (I haven't searched the archive extensively) Or maybe my message got catched by some spam filters? (it made it to the list archive though) Anyway, I would appreciate some feedback (through the list) Thanks From taj at www.linux.org.uk Tue Apr 5 14:42:28 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 21:42:28 +0100 (BST) Subject: [Rxtx] Closing a port from an event listener results in a deadlock In-Reply-To: <20050405175537.GA21747@rcog.homelinux.net> References: <20050405175537.GA21747@rcog.homelinux.net> Message-ID: On Tue, 5 Apr 2005 no_spam at somewhere.com wrote: > On the message I sent on March 14, does anyone had the chance to try the > modification? > > Or was it already fixed? (I haven't searched the archive extensively) > > Or maybe my message got catched by some spam filters? (it made it to the list > archive though) > > Anyway, I would appreciate some feedback (through the list) > The patch is here http://marc.theaimsgroup.com/?l=rxtx&m=111084488820288&w=2 I have applied this patch to a local copy but will not be doing formal testing for a couple weeks. I do not try to close ports from inside the eventListenter usually so I encourage any feedback also. If there are no problems reported, I expect this will go into rxtx 2.1-7. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Wed Apr 6 08:33:42 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Wed, 06 Apr 2005 15:33:42 +0100 Subject: [Rxtx] getting RXTX version Message-ID: <4253F346.50102@emation.pt> Hi, I want to make sure my deployments have the same version of RXTX jar and native lib. I know the version of the jar can be obtained in the Version class, but how can I obtain the native version ? I know RXTX prints to the console a warning if the version is different. Is there a way to programatically know is this is the case ? I would like to log that to our app's log thanks Ricardo From taj at www.linux.org.uk Wed Apr 6 15:10:20 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 6 Apr 2005 22:10:20 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4253F346.50102@emation.pt> References: <4253F346.50102@emation.pt> Message-ID: On Wed, 6 Apr 2005, Ricardo Trindade wrote: > Hi, > > I want to make sure my deployments have the same version of RXTX jar > and native lib. > > I know the version of the jar can be obtained in the Version class, > but how can I obtain the native version ? > > I know RXTX prints to the console a warning if the version is > different. Is there a way to programatically know is this is the case ? > > I would like to log that to our app's log > There isn't a suggested way of doing that right now. We could move things around and have a static String RXTXVersion.getNativeVersion() in future releases. Is this what you expected? This is not documented in commapi at all. I just tossed that in to catch conflicts while developing. It would be nice to have access in GUI applications though. It may be possible to access RXTXCommDriver.LibVersion right now. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Thu Apr 7 02:51:00 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 09:51:00 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> Message-ID: <4254F474.7020905@emation.pt> >There isn't a suggested way of doing that right now. We could move things >around and have a static String RXTXVersion.getNativeVersion() in future >releases. Is this what you expected? > > Yes, that would be perfect. >This is not documented in commapi at all. I just tossed that in to catch >conflicts while developing. It would be nice to have access in GUI >applications though. > >It may be possible to access RXTXCommDriver.LibVersion right now. > > > I tried, and I don't think it's possible. From taj at www.linux.org.uk Thu Apr 7 03:32:04 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 7 Apr 2005 10:32:04 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4254F474.7020905@emation.pt> References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: On Thu, 7 Apr 2005, Ricardo Trindade wrote: > > >There isn't a suggested way of doing that right now. We could move things > >around and have a static String RXTXVersion.getNativeVersion() in future > >releases. Is this what you expected? > > > > > > Yes, that would be perfect. > The attached should do what you want. You will still need to catch an exception for older versions... -- Trent Jarvi taj at www.linux.org.uk -------------- next part -------------- ? public_version.patch Index: RXTXCommDriver.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXCommDriver.java,v retrieving revision 1.16.2.51 diff -u -r1.16.2.51 RXTXCommDriver.java --- RXTXCommDriver.java 12 Oct 2004 09:13:30 -0000 1.16.2.51 +++ RXTXCommDriver.java 7 Apr 2005 09:29:04 -0000 @@ -54,7 +54,7 @@ the Library. */ String JarVersion = RXTXVersion.getVersion(); - String LibVersion = nativeGetVersion(); + String LibVersion = RXTXVersion.nativeGetVersion(); if ( devel ) { System.out.println("Devel Library"); @@ -76,7 +76,6 @@ /** Get the Serial port prefixes for the running OS */ private String deviceDirectory; private String osName; - private static native String nativeGetVersion(); private native boolean registerKnownPorts(int PortType); private native boolean isPortPrefixValid(String dev); private native boolean testRead(String dev, int type); Index: RXTXVersion.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXVersion.java,v retrieving revision 1.2.2.31 diff -u -r1.2.2.31 RXTXVersion.java --- RXTXVersion.java 16 Oct 2004 16:20:35 -0000 1.2.2.31 +++ RXTXVersion.java 7 Apr 2005 09:29:04 -0000 @@ -36,6 +36,7 @@ private static String Version; static { + System.loadLibrary( "rxtxSerial" ); Version = "RXTX-2.1-7pre20"; } /** @@ -47,4 +48,5 @@ { return(Version); } + public static native String nativeGetVersion(); } Index: SerialImp.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v retrieving revision 1.46.2.181 diff -u -r1.46.2.181 SerialImp.c --- SerialImp.c 17 Oct 2004 09:48:56 -0000 1.46.2.181 +++ SerialImp.c 7 Apr 2005 09:29:07 -0000 @@ -116,6 +116,7 @@ * It will eventually be removed. * */ #define RXTXPort(foo) Java_gnu_io_RXTXPort_ ## foo +#define RXTXVersion(foo) Java_gnu_io_RXTXVersion_ ## foo #define RXTXCommDriver(foo) Java_gnu_io_RXTXCommDriver_ ## foo #if defined(__sun__) || defined(__hpux__) @@ -4001,7 +4002,7 @@ } /*---------------------------------------------------------- -RXTXCommDriver.nativeGetVersion +RXTXVersion.nativeGetVersion accept: none perform: return the current version @@ -4010,9 +4011,10 @@ comments: This is used to avoid mixing versions of the .jar and native library. First introduced in rxtx-1.5-9 + Moved from RXTXCommDriver to RXTXVersion in rxtx-2.1-7 ----------------------------------------------------------*/ -JNIEXPORT jstring JNICALL RXTXCommDriver(nativeGetVersion) (JNIEnv *env, +JNIEXPORT jstring JNICALL RXTXVersion(nativeGetVersion) (JNIEnv *env, jclass jclazz ) { return (*env)->NewStringUTF( env, "RXTX-2.1-7pre20" ); From ricardo.trindade at emation.pt Thu Apr 7 03:45:58 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 10:45:58 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: <42550156.2040908@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050407/05212451/attachment-0123.html From thomas.shulok at lmco.com Thu Apr 7 17:43:11 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Thu, 07 Apr 2005 19:43:11 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi There, I'm attempting to talk RS232 between an embedded Linux box and a Windows box. Everything connects up fine, and I can send and receive a simple sequence of bytes with no problems. However, if around 5 seconds goes by without me sending something, I get the following when I attempt to send. java.io.IOException: Input/output error in writeArray Stack trace: java/lang/Throwable.()V java/lang/Throwable.(Ljava/lang/String;)V java/io/IOException.(Ljava/lang/String;)V gnu/io/RXTXPort.writeArray([BIIZ)V gnu/io/RXTXPort$SerialOutputStream.write([B)V SerialTest.main([Ljava/lang/String;)V If there interval is shorter (say 2 seconds between sends), I have no problems. On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and librxtxSerial-2.0.7pre2.so. Any ideas? Thanks, Thom -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5b23dcf/attachment-0123.html From taj at www.linux.org.uk Thu Apr 7 19:22:36 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:22:36 +0100 (BST) Subject: [Rxtx] Input/output error in writeArray In-Reply-To: References: Message-ID: On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a Windows > box. Everything connects up fine, and I can send and receive a simple > sequence of bytes with no problems. However, if around 5 seconds goes > by without me sending something, I get the following when I attempt to > send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Apr 7 19:24:59 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:24:59 +0100 (BST) Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) Message-ID: hmm. This would not work from applets would it? -- Trent Jarvi taj at www.linux.org.uk ---------- Forwarded message ---------- Date: Thu, 07 Apr 2005 16:05:53 -0400 From: Chris Gaffney To: taj at www.linux.org.uk Subject: RXTX Libraries on Classpath fix Hi, I submitted a patch for RXTX a few weeks ago to allow for loading the native libraries from the classpath. Since sending it to you I found it wasn't working on windows. I've fixed the problem and created a new patch that should replace the older one. The actual change is a one line from a String.equals() to a String.startsWith(). Thanks for a great piece of software, -Chris Gaffney Grand Valley State University -------------- next part -------------- A non-text attachment was scrubbed... Name: libraries_on_classpath_fixed.patch Type: text/x-patch Size: 5617 bytes Desc: Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5d423b8/libraries_on_classpath_fixed-0123.bin From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From thomas.shulok at lmco.com Fri Apr 8 10:38:55 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Fri, 08 Apr 2005 12:38:55 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi Trent, Thanks for the prompt response. Before diving deeper, I was wondering if there is a timeout parameter somewhere in the stack that I have not set properly. Given the nature of the failure (only fails if the line has been idle for a few seconds), it feels like some kind of timeout issue... Thanks again, Thom -----Original Message----- From: rxtx-bounces at mail.linuxgrrls.org [mailto:rxtx-bounces at mail.linuxgrrls.org] On Behalf Of Trent Jarvi Sent: Thursday, April 07, 2005 6:23 PM To: Java RXTX discussion Subject: Re: [Rxtx] Input/output error in writeArray On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a > Windows box. Everything connects up fine, and I can send and receive > a simple sequence of bytes with no problems. However, if around 5 > seconds goes by without me sending something, I get the following when > I attempt to send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at mail.linuxgrrls.org http://mail.linuxgrrls.org/mailman/listinfo/rxtx From ricardo.trindade at emation.pt Mon Apr 4 09:17:23 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Mon, 04 Apr 2005 16:17:23 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot Message-ID: <42515A83.4050907@emation.pt> Hi, I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most recent stable snapshot), and get the following exception : It looks like rxtx has been compiled with jdk 1.5. If this was indeed the case, I think there is a compilation flag that generates code that runs on older jdks. java.lang.UnsupportedClassVersionError: gnu/io/UnsupportedCommOperationException (Unsupported major.minor version 49.0) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at java.net.URLClassLoader.defineClass(URLClassLoader.java:251) at java.net.URLClassLoader.access$100(URLClassLoader.java:55) at java.net.URLClassLoader$1.run(URLClassLoader.java:194) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:187) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:141) I'm trying to run it with 1.4. thanks Ricardo From taj at www.linux.org.uk Tue Apr 5 00:48:12 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 07:48:12 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42515A83.4050907@emation.pt> References: <42515A83.4050907@emation.pt> Message-ID: On Mon, 4 Apr 2005, Ricardo Trindade wrote: > Hi, > > I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most > recent stable snapshot), and get the following exception : > > It looks like rxtx has been compiled with jdk 1.5. If this was > indeed the case, I think there is a compilation flag that generates code > that runs on older jdks. > > java.lang.UnsupportedClassVersionError: > gnu/io/UnsupportedCommOperationException (Unsupported major.minor > version 49.0) [snip] Thanks Ricardo I recompiled the jar with javac -source 1.3 -target 1.3. That should cover most of the JRE's in use today. I also compiled the rxtx 2.0 x86_64 native library which appeared to be missing. I tried looking for flags to pass gcc 4.0 to make the native libraries more backwards compatible but only found options for C++ which is not used in rxtx. I've got a list of other bugs that I'll be going through in the next few weeks but for now I just left them with the same CVS filename - no code changes. ftp://ftp.qbang.org/pub/rxtx/rxtx-2.0-CVS-20050120-bins.tar.gz ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-CVS-20050120-bins.tar.gz -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Tue Apr 5 02:24:33 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 05 Apr 2005 09:24:33 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: References: <42515A83.4050907@emation.pt> Message-ID: <42524B41.3040300@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050405/5919abbb/attachment-0124.html From taj at www.linux.org.uk Tue Apr 5 03:00:29 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 10:00:29 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42524B41.3040300@emation.pt> References: <42515A83.4050907@emation.pt> <42524B41.3040300@emation.pt> Message-ID: On Tue, 5 Apr 2005, Ricardo Trindade wrote: > Will you anounce to the list when a new release is available ? > There will be several incremental releases announced here. Once those are done, we will release 2.1.7 and 2.0.7. -- Trent Jarvi taj at www.linux.org.uk From no_spam at somewhere.com Tue Apr 5 11:55:37 2005 From: no_spam at somewhere.com (no_spam@somewhere.com) Date: Tue, 5 Apr 2005 13:55:37 -0400 Subject: [Rxtx] Closing a port from an event listener results in a deadlock Message-ID: <20050405175537.GA21747@rcog.homelinux.net> On the message I sent on March 14, does anyone had the chance to try the modification? Or was it already fixed? (I haven't searched the archive extensively) Or maybe my message got catched by some spam filters? (it made it to the list archive though) Anyway, I would appreciate some feedback (through the list) Thanks From taj at www.linux.org.uk Tue Apr 5 14:42:28 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 21:42:28 +0100 (BST) Subject: [Rxtx] Closing a port from an event listener results in a deadlock In-Reply-To: <20050405175537.GA21747@rcog.homelinux.net> References: <20050405175537.GA21747@rcog.homelinux.net> Message-ID: On Tue, 5 Apr 2005 no_spam at somewhere.com wrote: > On the message I sent on March 14, does anyone had the chance to try the > modification? > > Or was it already fixed? (I haven't searched the archive extensively) > > Or maybe my message got catched by some spam filters? (it made it to the list > archive though) > > Anyway, I would appreciate some feedback (through the list) > The patch is here http://marc.theaimsgroup.com/?l=rxtx&m=111084488820288&w=2 I have applied this patch to a local copy but will not be doing formal testing for a couple weeks. I do not try to close ports from inside the eventListenter usually so I encourage any feedback also. If there are no problems reported, I expect this will go into rxtx 2.1-7. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Wed Apr 6 08:33:42 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Wed, 06 Apr 2005 15:33:42 +0100 Subject: [Rxtx] getting RXTX version Message-ID: <4253F346.50102@emation.pt> Hi, I want to make sure my deployments have the same version of RXTX jar and native lib. I know the version of the jar can be obtained in the Version class, but how can I obtain the native version ? I know RXTX prints to the console a warning if the version is different. Is there a way to programatically know is this is the case ? I would like to log that to our app's log thanks Ricardo From taj at www.linux.org.uk Wed Apr 6 15:10:20 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 6 Apr 2005 22:10:20 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4253F346.50102@emation.pt> References: <4253F346.50102@emation.pt> Message-ID: On Wed, 6 Apr 2005, Ricardo Trindade wrote: > Hi, > > I want to make sure my deployments have the same version of RXTX jar > and native lib. > > I know the version of the jar can be obtained in the Version class, > but how can I obtain the native version ? > > I know RXTX prints to the console a warning if the version is > different. Is there a way to programatically know is this is the case ? > > I would like to log that to our app's log > There isn't a suggested way of doing that right now. We could move things around and have a static String RXTXVersion.getNativeVersion() in future releases. Is this what you expected? This is not documented in commapi at all. I just tossed that in to catch conflicts while developing. It would be nice to have access in GUI applications though. It may be possible to access RXTXCommDriver.LibVersion right now. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Thu Apr 7 02:51:00 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 09:51:00 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> Message-ID: <4254F474.7020905@emation.pt> >There isn't a suggested way of doing that right now. We could move things >around and have a static String RXTXVersion.getNativeVersion() in future >releases. Is this what you expected? > > Yes, that would be perfect. >This is not documented in commapi at all. I just tossed that in to catch >conflicts while developing. It would be nice to have access in GUI >applications though. > >It may be possible to access RXTXCommDriver.LibVersion right now. > > > I tried, and I don't think it's possible. From taj at www.linux.org.uk Thu Apr 7 03:32:04 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 7 Apr 2005 10:32:04 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4254F474.7020905@emation.pt> References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: On Thu, 7 Apr 2005, Ricardo Trindade wrote: > > >There isn't a suggested way of doing that right now. We could move things > >around and have a static String RXTXVersion.getNativeVersion() in future > >releases. Is this what you expected? > > > > > > Yes, that would be perfect. > The attached should do what you want. You will still need to catch an exception for older versions... -- Trent Jarvi taj at www.linux.org.uk -------------- next part -------------- ? public_version.patch Index: RXTXCommDriver.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXCommDriver.java,v retrieving revision 1.16.2.51 diff -u -r1.16.2.51 RXTXCommDriver.java --- RXTXCommDriver.java 12 Oct 2004 09:13:30 -0000 1.16.2.51 +++ RXTXCommDriver.java 7 Apr 2005 09:29:04 -0000 @@ -54,7 +54,7 @@ the Library. */ String JarVersion = RXTXVersion.getVersion(); - String LibVersion = nativeGetVersion(); + String LibVersion = RXTXVersion.nativeGetVersion(); if ( devel ) { System.out.println("Devel Library"); @@ -76,7 +76,6 @@ /** Get the Serial port prefixes for the running OS */ private String deviceDirectory; private String osName; - private static native String nativeGetVersion(); private native boolean registerKnownPorts(int PortType); private native boolean isPortPrefixValid(String dev); private native boolean testRead(String dev, int type); Index: RXTXVersion.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXVersion.java,v retrieving revision 1.2.2.31 diff -u -r1.2.2.31 RXTXVersion.java --- RXTXVersion.java 16 Oct 2004 16:20:35 -0000 1.2.2.31 +++ RXTXVersion.java 7 Apr 2005 09:29:04 -0000 @@ -36,6 +36,7 @@ private static String Version; static { + System.loadLibrary( "rxtxSerial" ); Version = "RXTX-2.1-7pre20"; } /** @@ -47,4 +48,5 @@ { return(Version); } + public static native String nativeGetVersion(); } Index: SerialImp.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v retrieving revision 1.46.2.181 diff -u -r1.46.2.181 SerialImp.c --- SerialImp.c 17 Oct 2004 09:48:56 -0000 1.46.2.181 +++ SerialImp.c 7 Apr 2005 09:29:07 -0000 @@ -116,6 +116,7 @@ * It will eventually be removed. * */ #define RXTXPort(foo) Java_gnu_io_RXTXPort_ ## foo +#define RXTXVersion(foo) Java_gnu_io_RXTXVersion_ ## foo #define RXTXCommDriver(foo) Java_gnu_io_RXTXCommDriver_ ## foo #if defined(__sun__) || defined(__hpux__) @@ -4001,7 +4002,7 @@ } /*---------------------------------------------------------- -RXTXCommDriver.nativeGetVersion +RXTXVersion.nativeGetVersion accept: none perform: return the current version @@ -4010,9 +4011,10 @@ comments: This is used to avoid mixing versions of the .jar and native library. First introduced in rxtx-1.5-9 + Moved from RXTXCommDriver to RXTXVersion in rxtx-2.1-7 ----------------------------------------------------------*/ -JNIEXPORT jstring JNICALL RXTXCommDriver(nativeGetVersion) (JNIEnv *env, +JNIEXPORT jstring JNICALL RXTXVersion(nativeGetVersion) (JNIEnv *env, jclass jclazz ) { return (*env)->NewStringUTF( env, "RXTX-2.1-7pre20" ); From ricardo.trindade at emation.pt Thu Apr 7 03:45:58 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 10:45:58 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: <42550156.2040908@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050407/05212451/attachment-0124.html From thomas.shulok at lmco.com Thu Apr 7 17:43:11 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Thu, 07 Apr 2005 19:43:11 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi There, I'm attempting to talk RS232 between an embedded Linux box and a Windows box. Everything connects up fine, and I can send and receive a simple sequence of bytes with no problems. However, if around 5 seconds goes by without me sending something, I get the following when I attempt to send. java.io.IOException: Input/output error in writeArray Stack trace: java/lang/Throwable.()V java/lang/Throwable.(Ljava/lang/String;)V java/io/IOException.(Ljava/lang/String;)V gnu/io/RXTXPort.writeArray([BIIZ)V gnu/io/RXTXPort$SerialOutputStream.write([B)V SerialTest.main([Ljava/lang/String;)V If there interval is shorter (say 2 seconds between sends), I have no problems. On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and librxtxSerial-2.0.7pre2.so. Any ideas? Thanks, Thom -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5b23dcf/attachment-0124.html From taj at www.linux.org.uk Thu Apr 7 19:22:36 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:22:36 +0100 (BST) Subject: [Rxtx] Input/output error in writeArray In-Reply-To: References: Message-ID: On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a Windows > box. Everything connects up fine, and I can send and receive a simple > sequence of bytes with no problems. However, if around 5 seconds goes > by without me sending something, I get the following when I attempt to > send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Apr 7 19:24:59 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:24:59 +0100 (BST) Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) Message-ID: hmm. This would not work from applets would it? -- Trent Jarvi taj at www.linux.org.uk ---------- Forwarded message ---------- Date: Thu, 07 Apr 2005 16:05:53 -0400 From: Chris Gaffney To: taj at www.linux.org.uk Subject: RXTX Libraries on Classpath fix Hi, I submitted a patch for RXTX a few weeks ago to allow for loading the native libraries from the classpath. Since sending it to you I found it wasn't working on windows. I've fixed the problem and created a new patch that should replace the older one. The actual change is a one line from a String.equals() to a String.startsWith(). Thanks for a great piece of software, -Chris Gaffney Grand Valley State University -------------- next part -------------- A non-text attachment was scrubbed... Name: libraries_on_classpath_fixed.patch Type: text/x-patch Size: 5617 bytes Desc: Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5d423b8/libraries_on_classpath_fixed-0124.bin From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From thomas.shulok at lmco.com Fri Apr 8 10:38:55 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Fri, 08 Apr 2005 12:38:55 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi Trent, Thanks for the prompt response. Before diving deeper, I was wondering if there is a timeout parameter somewhere in the stack that I have not set properly. Given the nature of the failure (only fails if the line has been idle for a few seconds), it feels like some kind of timeout issue... Thanks again, Thom -----Original Message----- From: rxtx-bounces at mail.linuxgrrls.org [mailto:rxtx-bounces at mail.linuxgrrls.org] On Behalf Of Trent Jarvi Sent: Thursday, April 07, 2005 6:23 PM To: Java RXTX discussion Subject: Re: [Rxtx] Input/output error in writeArray On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a > Windows box. Everything connects up fine, and I can send and receive > a simple sequence of bytes with no problems. However, if around 5 > seconds goes by without me sending something, I get the following when > I attempt to send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at mail.linuxgrrls.org http://mail.linuxgrrls.org/mailman/listinfo/rxtx From ricardo.trindade at emation.pt Mon Apr 4 09:17:23 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Mon, 04 Apr 2005 16:17:23 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot Message-ID: <42515A83.4050907@emation.pt> Hi, I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most recent stable snapshot), and get the following exception : It looks like rxtx has been compiled with jdk 1.5. If this was indeed the case, I think there is a compilation flag that generates code that runs on older jdks. java.lang.UnsupportedClassVersionError: gnu/io/UnsupportedCommOperationException (Unsupported major.minor version 49.0) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at java.net.URLClassLoader.defineClass(URLClassLoader.java:251) at java.net.URLClassLoader.access$100(URLClassLoader.java:55) at java.net.URLClassLoader$1.run(URLClassLoader.java:194) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:187) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:141) I'm trying to run it with 1.4. thanks Ricardo From taj at www.linux.org.uk Tue Apr 5 00:48:12 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 07:48:12 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42515A83.4050907@emation.pt> References: <42515A83.4050907@emation.pt> Message-ID: On Mon, 4 Apr 2005, Ricardo Trindade wrote: > Hi, > > I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most > recent stable snapshot), and get the following exception : > > It looks like rxtx has been compiled with jdk 1.5. If this was > indeed the case, I think there is a compilation flag that generates code > that runs on older jdks. > > java.lang.UnsupportedClassVersionError: > gnu/io/UnsupportedCommOperationException (Unsupported major.minor > version 49.0) [snip] Thanks Ricardo I recompiled the jar with javac -source 1.3 -target 1.3. That should cover most of the JRE's in use today. I also compiled the rxtx 2.0 x86_64 native library which appeared to be missing. I tried looking for flags to pass gcc 4.0 to make the native libraries more backwards compatible but only found options for C++ which is not used in rxtx. I've got a list of other bugs that I'll be going through in the next few weeks but for now I just left them with the same CVS filename - no code changes. ftp://ftp.qbang.org/pub/rxtx/rxtx-2.0-CVS-20050120-bins.tar.gz ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-CVS-20050120-bins.tar.gz -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Tue Apr 5 02:24:33 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 05 Apr 2005 09:24:33 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: References: <42515A83.4050907@emation.pt> Message-ID: <42524B41.3040300@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050405/5919abbb/attachment-0125.html From taj at www.linux.org.uk Tue Apr 5 03:00:29 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 10:00:29 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42524B41.3040300@emation.pt> References: <42515A83.4050907@emation.pt> <42524B41.3040300@emation.pt> Message-ID: On Tue, 5 Apr 2005, Ricardo Trindade wrote: > Will you anounce to the list when a new release is available ? > There will be several incremental releases announced here. Once those are done, we will release 2.1.7 and 2.0.7. -- Trent Jarvi taj at www.linux.org.uk From no_spam at somewhere.com Tue Apr 5 11:55:37 2005 From: no_spam at somewhere.com (no_spam@somewhere.com) Date: Tue, 5 Apr 2005 13:55:37 -0400 Subject: [Rxtx] Closing a port from an event listener results in a deadlock Message-ID: <20050405175537.GA21747@rcog.homelinux.net> On the message I sent on March 14, does anyone had the chance to try the modification? Or was it already fixed? (I haven't searched the archive extensively) Or maybe my message got catched by some spam filters? (it made it to the list archive though) Anyway, I would appreciate some feedback (through the list) Thanks From taj at www.linux.org.uk Tue Apr 5 14:42:28 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 21:42:28 +0100 (BST) Subject: [Rxtx] Closing a port from an event listener results in a deadlock In-Reply-To: <20050405175537.GA21747@rcog.homelinux.net> References: <20050405175537.GA21747@rcog.homelinux.net> Message-ID: On Tue, 5 Apr 2005 no_spam at somewhere.com wrote: > On the message I sent on March 14, does anyone had the chance to try the > modification? > > Or was it already fixed? (I haven't searched the archive extensively) > > Or maybe my message got catched by some spam filters? (it made it to the list > archive though) > > Anyway, I would appreciate some feedback (through the list) > The patch is here http://marc.theaimsgroup.com/?l=rxtx&m=111084488820288&w=2 I have applied this patch to a local copy but will not be doing formal testing for a couple weeks. I do not try to close ports from inside the eventListenter usually so I encourage any feedback also. If there are no problems reported, I expect this will go into rxtx 2.1-7. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Wed Apr 6 08:33:42 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Wed, 06 Apr 2005 15:33:42 +0100 Subject: [Rxtx] getting RXTX version Message-ID: <4253F346.50102@emation.pt> Hi, I want to make sure my deployments have the same version of RXTX jar and native lib. I know the version of the jar can be obtained in the Version class, but how can I obtain the native version ? I know RXTX prints to the console a warning if the version is different. Is there a way to programatically know is this is the case ? I would like to log that to our app's log thanks Ricardo From taj at www.linux.org.uk Wed Apr 6 15:10:20 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 6 Apr 2005 22:10:20 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4253F346.50102@emation.pt> References: <4253F346.50102@emation.pt> Message-ID: On Wed, 6 Apr 2005, Ricardo Trindade wrote: > Hi, > > I want to make sure my deployments have the same version of RXTX jar > and native lib. > > I know the version of the jar can be obtained in the Version class, > but how can I obtain the native version ? > > I know RXTX prints to the console a warning if the version is > different. Is there a way to programatically know is this is the case ? > > I would like to log that to our app's log > There isn't a suggested way of doing that right now. We could move things around and have a static String RXTXVersion.getNativeVersion() in future releases. Is this what you expected? This is not documented in commapi at all. I just tossed that in to catch conflicts while developing. It would be nice to have access in GUI applications though. It may be possible to access RXTXCommDriver.LibVersion right now. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Thu Apr 7 02:51:00 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 09:51:00 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> Message-ID: <4254F474.7020905@emation.pt> >There isn't a suggested way of doing that right now. We could move things >around and have a static String RXTXVersion.getNativeVersion() in future >releases. Is this what you expected? > > Yes, that would be perfect. >This is not documented in commapi at all. I just tossed that in to catch >conflicts while developing. It would be nice to have access in GUI >applications though. > >It may be possible to access RXTXCommDriver.LibVersion right now. > > > I tried, and I don't think it's possible. From taj at www.linux.org.uk Thu Apr 7 03:32:04 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 7 Apr 2005 10:32:04 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4254F474.7020905@emation.pt> References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: On Thu, 7 Apr 2005, Ricardo Trindade wrote: > > >There isn't a suggested way of doing that right now. We could move things > >around and have a static String RXTXVersion.getNativeVersion() in future > >releases. Is this what you expected? > > > > > > Yes, that would be perfect. > The attached should do what you want. You will still need to catch an exception for older versions... -- Trent Jarvi taj at www.linux.org.uk -------------- next part -------------- ? public_version.patch Index: RXTXCommDriver.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXCommDriver.java,v retrieving revision 1.16.2.51 diff -u -r1.16.2.51 RXTXCommDriver.java --- RXTXCommDriver.java 12 Oct 2004 09:13:30 -0000 1.16.2.51 +++ RXTXCommDriver.java 7 Apr 2005 09:29:04 -0000 @@ -54,7 +54,7 @@ the Library. */ String JarVersion = RXTXVersion.getVersion(); - String LibVersion = nativeGetVersion(); + String LibVersion = RXTXVersion.nativeGetVersion(); if ( devel ) { System.out.println("Devel Library"); @@ -76,7 +76,6 @@ /** Get the Serial port prefixes for the running OS */ private String deviceDirectory; private String osName; - private static native String nativeGetVersion(); private native boolean registerKnownPorts(int PortType); private native boolean isPortPrefixValid(String dev); private native boolean testRead(String dev, int type); Index: RXTXVersion.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXVersion.java,v retrieving revision 1.2.2.31 diff -u -r1.2.2.31 RXTXVersion.java --- RXTXVersion.java 16 Oct 2004 16:20:35 -0000 1.2.2.31 +++ RXTXVersion.java 7 Apr 2005 09:29:04 -0000 @@ -36,6 +36,7 @@ private static String Version; static { + System.loadLibrary( "rxtxSerial" ); Version = "RXTX-2.1-7pre20"; } /** @@ -47,4 +48,5 @@ { return(Version); } + public static native String nativeGetVersion(); } Index: SerialImp.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v retrieving revision 1.46.2.181 diff -u -r1.46.2.181 SerialImp.c --- SerialImp.c 17 Oct 2004 09:48:56 -0000 1.46.2.181 +++ SerialImp.c 7 Apr 2005 09:29:07 -0000 @@ -116,6 +116,7 @@ * It will eventually be removed. * */ #define RXTXPort(foo) Java_gnu_io_RXTXPort_ ## foo +#define RXTXVersion(foo) Java_gnu_io_RXTXVersion_ ## foo #define RXTXCommDriver(foo) Java_gnu_io_RXTXCommDriver_ ## foo #if defined(__sun__) || defined(__hpux__) @@ -4001,7 +4002,7 @@ } /*---------------------------------------------------------- -RXTXCommDriver.nativeGetVersion +RXTXVersion.nativeGetVersion accept: none perform: return the current version @@ -4010,9 +4011,10 @@ comments: This is used to avoid mixing versions of the .jar and native library. First introduced in rxtx-1.5-9 + Moved from RXTXCommDriver to RXTXVersion in rxtx-2.1-7 ----------------------------------------------------------*/ -JNIEXPORT jstring JNICALL RXTXCommDriver(nativeGetVersion) (JNIEnv *env, +JNIEXPORT jstring JNICALL RXTXVersion(nativeGetVersion) (JNIEnv *env, jclass jclazz ) { return (*env)->NewStringUTF( env, "RXTX-2.1-7pre20" ); From ricardo.trindade at emation.pt Thu Apr 7 03:45:58 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 10:45:58 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: <42550156.2040908@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050407/05212451/attachment-0125.html From thomas.shulok at lmco.com Thu Apr 7 17:43:11 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Thu, 07 Apr 2005 19:43:11 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi There, I'm attempting to talk RS232 between an embedded Linux box and a Windows box. Everything connects up fine, and I can send and receive a simple sequence of bytes with no problems. However, if around 5 seconds goes by without me sending something, I get the following when I attempt to send. java.io.IOException: Input/output error in writeArray Stack trace: java/lang/Throwable.()V java/lang/Throwable.(Ljava/lang/String;)V java/io/IOException.(Ljava/lang/String;)V gnu/io/RXTXPort.writeArray([BIIZ)V gnu/io/RXTXPort$SerialOutputStream.write([B)V SerialTest.main([Ljava/lang/String;)V If there interval is shorter (say 2 seconds between sends), I have no problems. On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and librxtxSerial-2.0.7pre2.so. Any ideas? Thanks, Thom -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5b23dcf/attachment-0125.html From taj at www.linux.org.uk Thu Apr 7 19:22:36 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:22:36 +0100 (BST) Subject: [Rxtx] Input/output error in writeArray In-Reply-To: References: Message-ID: On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a Windows > box. Everything connects up fine, and I can send and receive a simple > sequence of bytes with no problems. However, if around 5 seconds goes > by without me sending something, I get the following when I attempt to > send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Apr 7 19:24:59 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:24:59 +0100 (BST) Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) Message-ID: hmm. This would not work from applets would it? -- Trent Jarvi taj at www.linux.org.uk ---------- Forwarded message ---------- Date: Thu, 07 Apr 2005 16:05:53 -0400 From: Chris Gaffney To: taj at www.linux.org.uk Subject: RXTX Libraries on Classpath fix Hi, I submitted a patch for RXTX a few weeks ago to allow for loading the native libraries from the classpath. Since sending it to you I found it wasn't working on windows. I've fixed the problem and created a new patch that should replace the older one. The actual change is a one line from a String.equals() to a String.startsWith(). Thanks for a great piece of software, -Chris Gaffney Grand Valley State University -------------- next part -------------- A non-text attachment was scrubbed... Name: libraries_on_classpath_fixed.patch Type: text/x-patch Size: 5617 bytes Desc: Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5d423b8/libraries_on_classpath_fixed-0125.bin From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From thomas.shulok at lmco.com Fri Apr 8 10:38:55 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Fri, 08 Apr 2005 12:38:55 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi Trent, Thanks for the prompt response. Before diving deeper, I was wondering if there is a timeout parameter somewhere in the stack that I have not set properly. Given the nature of the failure (only fails if the line has been idle for a few seconds), it feels like some kind of timeout issue... Thanks again, Thom -----Original Message----- From: rxtx-bounces at mail.linuxgrrls.org [mailto:rxtx-bounces at mail.linuxgrrls.org] On Behalf Of Trent Jarvi Sent: Thursday, April 07, 2005 6:23 PM To: Java RXTX discussion Subject: Re: [Rxtx] Input/output error in writeArray On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a > Windows box. Everything connects up fine, and I can send and receive > a simple sequence of bytes with no problems. However, if around 5 > seconds goes by without me sending something, I get the following when > I attempt to send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at mail.linuxgrrls.org http://mail.linuxgrrls.org/mailman/listinfo/rxtx From ricardo.trindade at emation.pt Mon Apr 4 09:17:23 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Mon, 04 Apr 2005 16:17:23 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot Message-ID: <42515A83.4050907@emation.pt> Hi, I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most recent stable snapshot), and get the following exception : It looks like rxtx has been compiled with jdk 1.5. If this was indeed the case, I think there is a compilation flag that generates code that runs on older jdks. java.lang.UnsupportedClassVersionError: gnu/io/UnsupportedCommOperationException (Unsupported major.minor version 49.0) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at java.net.URLClassLoader.defineClass(URLClassLoader.java:251) at java.net.URLClassLoader.access$100(URLClassLoader.java:55) at java.net.URLClassLoader$1.run(URLClassLoader.java:194) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:187) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:141) I'm trying to run it with 1.4. thanks Ricardo From taj at www.linux.org.uk Tue Apr 5 00:48:12 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 07:48:12 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42515A83.4050907@emation.pt> References: <42515A83.4050907@emation.pt> Message-ID: On Mon, 4 Apr 2005, Ricardo Trindade wrote: > Hi, > > I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most > recent stable snapshot), and get the following exception : > > It looks like rxtx has been compiled with jdk 1.5. If this was > indeed the case, I think there is a compilation flag that generates code > that runs on older jdks. > > java.lang.UnsupportedClassVersionError: > gnu/io/UnsupportedCommOperationException (Unsupported major.minor > version 49.0) [snip] Thanks Ricardo I recompiled the jar with javac -source 1.3 -target 1.3. That should cover most of the JRE's in use today. I also compiled the rxtx 2.0 x86_64 native library which appeared to be missing. I tried looking for flags to pass gcc 4.0 to make the native libraries more backwards compatible but only found options for C++ which is not used in rxtx. I've got a list of other bugs that I'll be going through in the next few weeks but for now I just left them with the same CVS filename - no code changes. ftp://ftp.qbang.org/pub/rxtx/rxtx-2.0-CVS-20050120-bins.tar.gz ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-CVS-20050120-bins.tar.gz -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Tue Apr 5 02:24:33 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 05 Apr 2005 09:24:33 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: References: <42515A83.4050907@emation.pt> Message-ID: <42524B41.3040300@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050405/5919abbb/attachment-0126.html From taj at www.linux.org.uk Tue Apr 5 03:00:29 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 10:00:29 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42524B41.3040300@emation.pt> References: <42515A83.4050907@emation.pt> <42524B41.3040300@emation.pt> Message-ID: On Tue, 5 Apr 2005, Ricardo Trindade wrote: > Will you anounce to the list when a new release is available ? > There will be several incremental releases announced here. Once those are done, we will release 2.1.7 and 2.0.7. -- Trent Jarvi taj at www.linux.org.uk From no_spam at somewhere.com Tue Apr 5 11:55:37 2005 From: no_spam at somewhere.com (no_spam@somewhere.com) Date: Tue, 5 Apr 2005 13:55:37 -0400 Subject: [Rxtx] Closing a port from an event listener results in a deadlock Message-ID: <20050405175537.GA21747@rcog.homelinux.net> On the message I sent on March 14, does anyone had the chance to try the modification? Or was it already fixed? (I haven't searched the archive extensively) Or maybe my message got catched by some spam filters? (it made it to the list archive though) Anyway, I would appreciate some feedback (through the list) Thanks From taj at www.linux.org.uk Tue Apr 5 14:42:28 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 21:42:28 +0100 (BST) Subject: [Rxtx] Closing a port from an event listener results in a deadlock In-Reply-To: <20050405175537.GA21747@rcog.homelinux.net> References: <20050405175537.GA21747@rcog.homelinux.net> Message-ID: On Tue, 5 Apr 2005 no_spam at somewhere.com wrote: > On the message I sent on March 14, does anyone had the chance to try the > modification? > > Or was it already fixed? (I haven't searched the archive extensively) > > Or maybe my message got catched by some spam filters? (it made it to the list > archive though) > > Anyway, I would appreciate some feedback (through the list) > The patch is here http://marc.theaimsgroup.com/?l=rxtx&m=111084488820288&w=2 I have applied this patch to a local copy but will not be doing formal testing for a couple weeks. I do not try to close ports from inside the eventListenter usually so I encourage any feedback also. If there are no problems reported, I expect this will go into rxtx 2.1-7. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Wed Apr 6 08:33:42 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Wed, 06 Apr 2005 15:33:42 +0100 Subject: [Rxtx] getting RXTX version Message-ID: <4253F346.50102@emation.pt> Hi, I want to make sure my deployments have the same version of RXTX jar and native lib. I know the version of the jar can be obtained in the Version class, but how can I obtain the native version ? I know RXTX prints to the console a warning if the version is different. Is there a way to programatically know is this is the case ? I would like to log that to our app's log thanks Ricardo From taj at www.linux.org.uk Wed Apr 6 15:10:20 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 6 Apr 2005 22:10:20 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4253F346.50102@emation.pt> References: <4253F346.50102@emation.pt> Message-ID: On Wed, 6 Apr 2005, Ricardo Trindade wrote: > Hi, > > I want to make sure my deployments have the same version of RXTX jar > and native lib. > > I know the version of the jar can be obtained in the Version class, > but how can I obtain the native version ? > > I know RXTX prints to the console a warning if the version is > different. Is there a way to programatically know is this is the case ? > > I would like to log that to our app's log > There isn't a suggested way of doing that right now. We could move things around and have a static String RXTXVersion.getNativeVersion() in future releases. Is this what you expected? This is not documented in commapi at all. I just tossed that in to catch conflicts while developing. It would be nice to have access in GUI applications though. It may be possible to access RXTXCommDriver.LibVersion right now. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Thu Apr 7 02:51:00 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 09:51:00 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> Message-ID: <4254F474.7020905@emation.pt> >There isn't a suggested way of doing that right now. We could move things >around and have a static String RXTXVersion.getNativeVersion() in future >releases. Is this what you expected? > > Yes, that would be perfect. >This is not documented in commapi at all. I just tossed that in to catch >conflicts while developing. It would be nice to have access in GUI >applications though. > >It may be possible to access RXTXCommDriver.LibVersion right now. > > > I tried, and I don't think it's possible. From taj at www.linux.org.uk Thu Apr 7 03:32:04 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 7 Apr 2005 10:32:04 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4254F474.7020905@emation.pt> References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: On Thu, 7 Apr 2005, Ricardo Trindade wrote: > > >There isn't a suggested way of doing that right now. We could move things > >around and have a static String RXTXVersion.getNativeVersion() in future > >releases. Is this what you expected? > > > > > > Yes, that would be perfect. > The attached should do what you want. You will still need to catch an exception for older versions... -- Trent Jarvi taj at www.linux.org.uk -------------- next part -------------- ? public_version.patch Index: RXTXCommDriver.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXCommDriver.java,v retrieving revision 1.16.2.51 diff -u -r1.16.2.51 RXTXCommDriver.java --- RXTXCommDriver.java 12 Oct 2004 09:13:30 -0000 1.16.2.51 +++ RXTXCommDriver.java 7 Apr 2005 09:29:04 -0000 @@ -54,7 +54,7 @@ the Library. */ String JarVersion = RXTXVersion.getVersion(); - String LibVersion = nativeGetVersion(); + String LibVersion = RXTXVersion.nativeGetVersion(); if ( devel ) { System.out.println("Devel Library"); @@ -76,7 +76,6 @@ /** Get the Serial port prefixes for the running OS */ private String deviceDirectory; private String osName; - private static native String nativeGetVersion(); private native boolean registerKnownPorts(int PortType); private native boolean isPortPrefixValid(String dev); private native boolean testRead(String dev, int type); Index: RXTXVersion.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXVersion.java,v retrieving revision 1.2.2.31 diff -u -r1.2.2.31 RXTXVersion.java --- RXTXVersion.java 16 Oct 2004 16:20:35 -0000 1.2.2.31 +++ RXTXVersion.java 7 Apr 2005 09:29:04 -0000 @@ -36,6 +36,7 @@ private static String Version; static { + System.loadLibrary( "rxtxSerial" ); Version = "RXTX-2.1-7pre20"; } /** @@ -47,4 +48,5 @@ { return(Version); } + public static native String nativeGetVersion(); } Index: SerialImp.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v retrieving revision 1.46.2.181 diff -u -r1.46.2.181 SerialImp.c --- SerialImp.c 17 Oct 2004 09:48:56 -0000 1.46.2.181 +++ SerialImp.c 7 Apr 2005 09:29:07 -0000 @@ -116,6 +116,7 @@ * It will eventually be removed. * */ #define RXTXPort(foo) Java_gnu_io_RXTXPort_ ## foo +#define RXTXVersion(foo) Java_gnu_io_RXTXVersion_ ## foo #define RXTXCommDriver(foo) Java_gnu_io_RXTXCommDriver_ ## foo #if defined(__sun__) || defined(__hpux__) @@ -4001,7 +4002,7 @@ } /*---------------------------------------------------------- -RXTXCommDriver.nativeGetVersion +RXTXVersion.nativeGetVersion accept: none perform: return the current version @@ -4010,9 +4011,10 @@ comments: This is used to avoid mixing versions of the .jar and native library. First introduced in rxtx-1.5-9 + Moved from RXTXCommDriver to RXTXVersion in rxtx-2.1-7 ----------------------------------------------------------*/ -JNIEXPORT jstring JNICALL RXTXCommDriver(nativeGetVersion) (JNIEnv *env, +JNIEXPORT jstring JNICALL RXTXVersion(nativeGetVersion) (JNIEnv *env, jclass jclazz ) { return (*env)->NewStringUTF( env, "RXTX-2.1-7pre20" ); From ricardo.trindade at emation.pt Thu Apr 7 03:45:58 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 10:45:58 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: <42550156.2040908@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050407/05212451/attachment-0126.html From thomas.shulok at lmco.com Thu Apr 7 17:43:11 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Thu, 07 Apr 2005 19:43:11 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi There, I'm attempting to talk RS232 between an embedded Linux box and a Windows box. Everything connects up fine, and I can send and receive a simple sequence of bytes with no problems. However, if around 5 seconds goes by without me sending something, I get the following when I attempt to send. java.io.IOException: Input/output error in writeArray Stack trace: java/lang/Throwable.()V java/lang/Throwable.(Ljava/lang/String;)V java/io/IOException.(Ljava/lang/String;)V gnu/io/RXTXPort.writeArray([BIIZ)V gnu/io/RXTXPort$SerialOutputStream.write([B)V SerialTest.main([Ljava/lang/String;)V If there interval is shorter (say 2 seconds between sends), I have no problems. On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and librxtxSerial-2.0.7pre2.so. Any ideas? Thanks, Thom -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5b23dcf/attachment-0126.html From taj at www.linux.org.uk Thu Apr 7 19:22:36 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:22:36 +0100 (BST) Subject: [Rxtx] Input/output error in writeArray In-Reply-To: References: Message-ID: On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a Windows > box. Everything connects up fine, and I can send and receive a simple > sequence of bytes with no problems. However, if around 5 seconds goes > by without me sending something, I get the following when I attempt to > send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Apr 7 19:24:59 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:24:59 +0100 (BST) Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) Message-ID: hmm. This would not work from applets would it? -- Trent Jarvi taj at www.linux.org.uk ---------- Forwarded message ---------- Date: Thu, 07 Apr 2005 16:05:53 -0400 From: Chris Gaffney To: taj at www.linux.org.uk Subject: RXTX Libraries on Classpath fix Hi, I submitted a patch for RXTX a few weeks ago to allow for loading the native libraries from the classpath. Since sending it to you I found it wasn't working on windows. I've fixed the problem and created a new patch that should replace the older one. The actual change is a one line from a String.equals() to a String.startsWith(). Thanks for a great piece of software, -Chris Gaffney Grand Valley State University -------------- next part -------------- A non-text attachment was scrubbed... Name: libraries_on_classpath_fixed.patch Type: text/x-patch Size: 5617 bytes Desc: Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5d423b8/libraries_on_classpath_fixed-0126.bin From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From thomas.shulok at lmco.com Fri Apr 8 10:38:55 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Fri, 08 Apr 2005 12:38:55 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi Trent, Thanks for the prompt response. Before diving deeper, I was wondering if there is a timeout parameter somewhere in the stack that I have not set properly. Given the nature of the failure (only fails if the line has been idle for a few seconds), it feels like some kind of timeout issue... Thanks again, Thom -----Original Message----- From: rxtx-bounces at mail.linuxgrrls.org [mailto:rxtx-bounces at mail.linuxgrrls.org] On Behalf Of Trent Jarvi Sent: Thursday, April 07, 2005 6:23 PM To: Java RXTX discussion Subject: Re: [Rxtx] Input/output error in writeArray On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a > Windows box. Everything connects up fine, and I can send and receive > a simple sequence of bytes with no problems. However, if around 5 > seconds goes by without me sending something, I get the following when > I attempt to send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at mail.linuxgrrls.org http://mail.linuxgrrls.org/mailman/listinfo/rxtx From ricardo.trindade at emation.pt Mon Apr 4 09:17:23 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Mon, 04 Apr 2005 16:17:23 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot Message-ID: <42515A83.4050907@emation.pt> Hi, I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most recent stable snapshot), and get the following exception : It looks like rxtx has been compiled with jdk 1.5. If this was indeed the case, I think there is a compilation flag that generates code that runs on older jdks. java.lang.UnsupportedClassVersionError: gnu/io/UnsupportedCommOperationException (Unsupported major.minor version 49.0) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at java.net.URLClassLoader.defineClass(URLClassLoader.java:251) at java.net.URLClassLoader.access$100(URLClassLoader.java:55) at java.net.URLClassLoader$1.run(URLClassLoader.java:194) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:187) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:141) I'm trying to run it with 1.4. thanks Ricardo From taj at www.linux.org.uk Tue Apr 5 00:48:12 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 07:48:12 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42515A83.4050907@emation.pt> References: <42515A83.4050907@emation.pt> Message-ID: On Mon, 4 Apr 2005, Ricardo Trindade wrote: > Hi, > > I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most > recent stable snapshot), and get the following exception : > > It looks like rxtx has been compiled with jdk 1.5. If this was > indeed the case, I think there is a compilation flag that generates code > that runs on older jdks. > > java.lang.UnsupportedClassVersionError: > gnu/io/UnsupportedCommOperationException (Unsupported major.minor > version 49.0) [snip] Thanks Ricardo I recompiled the jar with javac -source 1.3 -target 1.3. That should cover most of the JRE's in use today. I also compiled the rxtx 2.0 x86_64 native library which appeared to be missing. I tried looking for flags to pass gcc 4.0 to make the native libraries more backwards compatible but only found options for C++ which is not used in rxtx. I've got a list of other bugs that I'll be going through in the next few weeks but for now I just left them with the same CVS filename - no code changes. ftp://ftp.qbang.org/pub/rxtx/rxtx-2.0-CVS-20050120-bins.tar.gz ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-CVS-20050120-bins.tar.gz -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Tue Apr 5 02:24:33 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 05 Apr 2005 09:24:33 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: References: <42515A83.4050907@emation.pt> Message-ID: <42524B41.3040300@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050405/5919abbb/attachment-0127.html From taj at www.linux.org.uk Tue Apr 5 03:00:29 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 10:00:29 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42524B41.3040300@emation.pt> References: <42515A83.4050907@emation.pt> <42524B41.3040300@emation.pt> Message-ID: On Tue, 5 Apr 2005, Ricardo Trindade wrote: > Will you anounce to the list when a new release is available ? > There will be several incremental releases announced here. Once those are done, we will release 2.1.7 and 2.0.7. -- Trent Jarvi taj at www.linux.org.uk From no_spam at somewhere.com Tue Apr 5 11:55:37 2005 From: no_spam at somewhere.com (no_spam@somewhere.com) Date: Tue, 5 Apr 2005 13:55:37 -0400 Subject: [Rxtx] Closing a port from an event listener results in a deadlock Message-ID: <20050405175537.GA21747@rcog.homelinux.net> On the message I sent on March 14, does anyone had the chance to try the modification? Or was it already fixed? (I haven't searched the archive extensively) Or maybe my message got catched by some spam filters? (it made it to the list archive though) Anyway, I would appreciate some feedback (through the list) Thanks From taj at www.linux.org.uk Tue Apr 5 14:42:28 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 21:42:28 +0100 (BST) Subject: [Rxtx] Closing a port from an event listener results in a deadlock In-Reply-To: <20050405175537.GA21747@rcog.homelinux.net> References: <20050405175537.GA21747@rcog.homelinux.net> Message-ID: On Tue, 5 Apr 2005 no_spam at somewhere.com wrote: > On the message I sent on March 14, does anyone had the chance to try the > modification? > > Or was it already fixed? (I haven't searched the archive extensively) > > Or maybe my message got catched by some spam filters? (it made it to the list > archive though) > > Anyway, I would appreciate some feedback (through the list) > The patch is here http://marc.theaimsgroup.com/?l=rxtx&m=111084488820288&w=2 I have applied this patch to a local copy but will not be doing formal testing for a couple weeks. I do not try to close ports from inside the eventListenter usually so I encourage any feedback also. If there are no problems reported, I expect this will go into rxtx 2.1-7. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Wed Apr 6 08:33:42 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Wed, 06 Apr 2005 15:33:42 +0100 Subject: [Rxtx] getting RXTX version Message-ID: <4253F346.50102@emation.pt> Hi, I want to make sure my deployments have the same version of RXTX jar and native lib. I know the version of the jar can be obtained in the Version class, but how can I obtain the native version ? I know RXTX prints to the console a warning if the version is different. Is there a way to programatically know is this is the case ? I would like to log that to our app's log thanks Ricardo From taj at www.linux.org.uk Wed Apr 6 15:10:20 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 6 Apr 2005 22:10:20 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4253F346.50102@emation.pt> References: <4253F346.50102@emation.pt> Message-ID: On Wed, 6 Apr 2005, Ricardo Trindade wrote: > Hi, > > I want to make sure my deployments have the same version of RXTX jar > and native lib. > > I know the version of the jar can be obtained in the Version class, > but how can I obtain the native version ? > > I know RXTX prints to the console a warning if the version is > different. Is there a way to programatically know is this is the case ? > > I would like to log that to our app's log > There isn't a suggested way of doing that right now. We could move things around and have a static String RXTXVersion.getNativeVersion() in future releases. Is this what you expected? This is not documented in commapi at all. I just tossed that in to catch conflicts while developing. It would be nice to have access in GUI applications though. It may be possible to access RXTXCommDriver.LibVersion right now. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Thu Apr 7 02:51:00 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 09:51:00 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> Message-ID: <4254F474.7020905@emation.pt> >There isn't a suggested way of doing that right now. We could move things >around and have a static String RXTXVersion.getNativeVersion() in future >releases. Is this what you expected? > > Yes, that would be perfect. >This is not documented in commapi at all. I just tossed that in to catch >conflicts while developing. It would be nice to have access in GUI >applications though. > >It may be possible to access RXTXCommDriver.LibVersion right now. > > > I tried, and I don't think it's possible. From taj at www.linux.org.uk Thu Apr 7 03:32:04 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 7 Apr 2005 10:32:04 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4254F474.7020905@emation.pt> References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: On Thu, 7 Apr 2005, Ricardo Trindade wrote: > > >There isn't a suggested way of doing that right now. We could move things > >around and have a static String RXTXVersion.getNativeVersion() in future > >releases. Is this what you expected? > > > > > > Yes, that would be perfect. > The attached should do what you want. You will still need to catch an exception for older versions... -- Trent Jarvi taj at www.linux.org.uk -------------- next part -------------- ? public_version.patch Index: RXTXCommDriver.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXCommDriver.java,v retrieving revision 1.16.2.51 diff -u -r1.16.2.51 RXTXCommDriver.java --- RXTXCommDriver.java 12 Oct 2004 09:13:30 -0000 1.16.2.51 +++ RXTXCommDriver.java 7 Apr 2005 09:29:04 -0000 @@ -54,7 +54,7 @@ the Library. */ String JarVersion = RXTXVersion.getVersion(); - String LibVersion = nativeGetVersion(); + String LibVersion = RXTXVersion.nativeGetVersion(); if ( devel ) { System.out.println("Devel Library"); @@ -76,7 +76,6 @@ /** Get the Serial port prefixes for the running OS */ private String deviceDirectory; private String osName; - private static native String nativeGetVersion(); private native boolean registerKnownPorts(int PortType); private native boolean isPortPrefixValid(String dev); private native boolean testRead(String dev, int type); Index: RXTXVersion.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXVersion.java,v retrieving revision 1.2.2.31 diff -u -r1.2.2.31 RXTXVersion.java --- RXTXVersion.java 16 Oct 2004 16:20:35 -0000 1.2.2.31 +++ RXTXVersion.java 7 Apr 2005 09:29:04 -0000 @@ -36,6 +36,7 @@ private static String Version; static { + System.loadLibrary( "rxtxSerial" ); Version = "RXTX-2.1-7pre20"; } /** @@ -47,4 +48,5 @@ { return(Version); } + public static native String nativeGetVersion(); } Index: SerialImp.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v retrieving revision 1.46.2.181 diff -u -r1.46.2.181 SerialImp.c --- SerialImp.c 17 Oct 2004 09:48:56 -0000 1.46.2.181 +++ SerialImp.c 7 Apr 2005 09:29:07 -0000 @@ -116,6 +116,7 @@ * It will eventually be removed. * */ #define RXTXPort(foo) Java_gnu_io_RXTXPort_ ## foo +#define RXTXVersion(foo) Java_gnu_io_RXTXVersion_ ## foo #define RXTXCommDriver(foo) Java_gnu_io_RXTXCommDriver_ ## foo #if defined(__sun__) || defined(__hpux__) @@ -4001,7 +4002,7 @@ } /*---------------------------------------------------------- -RXTXCommDriver.nativeGetVersion +RXTXVersion.nativeGetVersion accept: none perform: return the current version @@ -4010,9 +4011,10 @@ comments: This is used to avoid mixing versions of the .jar and native library. First introduced in rxtx-1.5-9 + Moved from RXTXCommDriver to RXTXVersion in rxtx-2.1-7 ----------------------------------------------------------*/ -JNIEXPORT jstring JNICALL RXTXCommDriver(nativeGetVersion) (JNIEnv *env, +JNIEXPORT jstring JNICALL RXTXVersion(nativeGetVersion) (JNIEnv *env, jclass jclazz ) { return (*env)->NewStringUTF( env, "RXTX-2.1-7pre20" ); From ricardo.trindade at emation.pt Thu Apr 7 03:45:58 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 10:45:58 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: <42550156.2040908@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050407/05212451/attachment-0127.html From thomas.shulok at lmco.com Thu Apr 7 17:43:11 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Thu, 07 Apr 2005 19:43:11 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi There, I'm attempting to talk RS232 between an embedded Linux box and a Windows box. Everything connects up fine, and I can send and receive a simple sequence of bytes with no problems. However, if around 5 seconds goes by without me sending something, I get the following when I attempt to send. java.io.IOException: Input/output error in writeArray Stack trace: java/lang/Throwable.()V java/lang/Throwable.(Ljava/lang/String;)V java/io/IOException.(Ljava/lang/String;)V gnu/io/RXTXPort.writeArray([BIIZ)V gnu/io/RXTXPort$SerialOutputStream.write([B)V SerialTest.main([Ljava/lang/String;)V If there interval is shorter (say 2 seconds between sends), I have no problems. On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and librxtxSerial-2.0.7pre2.so. Any ideas? Thanks, Thom -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5b23dcf/attachment-0127.html From taj at www.linux.org.uk Thu Apr 7 19:22:36 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:22:36 +0100 (BST) Subject: [Rxtx] Input/output error in writeArray In-Reply-To: References: Message-ID: On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a Windows > box. Everything connects up fine, and I can send and receive a simple > sequence of bytes with no problems. However, if around 5 seconds goes > by without me sending something, I get the following when I attempt to > send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Apr 7 19:24:59 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:24:59 +0100 (BST) Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) Message-ID: hmm. This would not work from applets would it? -- Trent Jarvi taj at www.linux.org.uk ---------- Forwarded message ---------- Date: Thu, 07 Apr 2005 16:05:53 -0400 From: Chris Gaffney To: taj at www.linux.org.uk Subject: RXTX Libraries on Classpath fix Hi, I submitted a patch for RXTX a few weeks ago to allow for loading the native libraries from the classpath. Since sending it to you I found it wasn't working on windows. I've fixed the problem and created a new patch that should replace the older one. The actual change is a one line from a String.equals() to a String.startsWith(). Thanks for a great piece of software, -Chris Gaffney Grand Valley State University -------------- next part -------------- A non-text attachment was scrubbed... Name: libraries_on_classpath_fixed.patch Type: text/x-patch Size: 5617 bytes Desc: Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5d423b8/libraries_on_classpath_fixed-0127.bin From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From thomas.shulok at lmco.com Fri Apr 8 10:38:55 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Fri, 08 Apr 2005 12:38:55 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi Trent, Thanks for the prompt response. Before diving deeper, I was wondering if there is a timeout parameter somewhere in the stack that I have not set properly. Given the nature of the failure (only fails if the line has been idle for a few seconds), it feels like some kind of timeout issue... Thanks again, Thom -----Original Message----- From: rxtx-bounces at mail.linuxgrrls.org [mailto:rxtx-bounces at mail.linuxgrrls.org] On Behalf Of Trent Jarvi Sent: Thursday, April 07, 2005 6:23 PM To: Java RXTX discussion Subject: Re: [Rxtx] Input/output error in writeArray On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a > Windows box. Everything connects up fine, and I can send and receive > a simple sequence of bytes with no problems. However, if around 5 > seconds goes by without me sending something, I get the following when > I attempt to send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at mail.linuxgrrls.org http://mail.linuxgrrls.org/mailman/listinfo/rxtx From ricardo.trindade at emation.pt Mon Apr 4 09:17:23 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Mon, 04 Apr 2005 16:17:23 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot Message-ID: <42515A83.4050907@emation.pt> Hi, I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most recent stable snapshot), and get the following exception : It looks like rxtx has been compiled with jdk 1.5. If this was indeed the case, I think there is a compilation flag that generates code that runs on older jdks. java.lang.UnsupportedClassVersionError: gnu/io/UnsupportedCommOperationException (Unsupported major.minor version 49.0) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at java.net.URLClassLoader.defineClass(URLClassLoader.java:251) at java.net.URLClassLoader.access$100(URLClassLoader.java:55) at java.net.URLClassLoader$1.run(URLClassLoader.java:194) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:187) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:141) I'm trying to run it with 1.4. thanks Ricardo From taj at www.linux.org.uk Tue Apr 5 00:48:12 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 07:48:12 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42515A83.4050907@emation.pt> References: <42515A83.4050907@emation.pt> Message-ID: On Mon, 4 Apr 2005, Ricardo Trindade wrote: > Hi, > > I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most > recent stable snapshot), and get the following exception : > > It looks like rxtx has been compiled with jdk 1.5. If this was > indeed the case, I think there is a compilation flag that generates code > that runs on older jdks. > > java.lang.UnsupportedClassVersionError: > gnu/io/UnsupportedCommOperationException (Unsupported major.minor > version 49.0) [snip] Thanks Ricardo I recompiled the jar with javac -source 1.3 -target 1.3. That should cover most of the JRE's in use today. I also compiled the rxtx 2.0 x86_64 native library which appeared to be missing. I tried looking for flags to pass gcc 4.0 to make the native libraries more backwards compatible but only found options for C++ which is not used in rxtx. I've got a list of other bugs that I'll be going through in the next few weeks but for now I just left them with the same CVS filename - no code changes. ftp://ftp.qbang.org/pub/rxtx/rxtx-2.0-CVS-20050120-bins.tar.gz ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-CVS-20050120-bins.tar.gz -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Tue Apr 5 02:24:33 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 05 Apr 2005 09:24:33 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: References: <42515A83.4050907@emation.pt> Message-ID: <42524B41.3040300@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050405/5919abbb/attachment-0128.html From taj at www.linux.org.uk Tue Apr 5 03:00:29 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 10:00:29 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42524B41.3040300@emation.pt> References: <42515A83.4050907@emation.pt> <42524B41.3040300@emation.pt> Message-ID: On Tue, 5 Apr 2005, Ricardo Trindade wrote: > Will you anounce to the list when a new release is available ? > There will be several incremental releases announced here. Once those are done, we will release 2.1.7 and 2.0.7. -- Trent Jarvi taj at www.linux.org.uk From no_spam at somewhere.com Tue Apr 5 11:55:37 2005 From: no_spam at somewhere.com (no_spam@somewhere.com) Date: Tue, 5 Apr 2005 13:55:37 -0400 Subject: [Rxtx] Closing a port from an event listener results in a deadlock Message-ID: <20050405175537.GA21747@rcog.homelinux.net> On the message I sent on March 14, does anyone had the chance to try the modification? Or was it already fixed? (I haven't searched the archive extensively) Or maybe my message got catched by some spam filters? (it made it to the list archive though) Anyway, I would appreciate some feedback (through the list) Thanks From taj at www.linux.org.uk Tue Apr 5 14:42:28 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 21:42:28 +0100 (BST) Subject: [Rxtx] Closing a port from an event listener results in a deadlock In-Reply-To: <20050405175537.GA21747@rcog.homelinux.net> References: <20050405175537.GA21747@rcog.homelinux.net> Message-ID: On Tue, 5 Apr 2005 no_spam at somewhere.com wrote: > On the message I sent on March 14, does anyone had the chance to try the > modification? > > Or was it already fixed? (I haven't searched the archive extensively) > > Or maybe my message got catched by some spam filters? (it made it to the list > archive though) > > Anyway, I would appreciate some feedback (through the list) > The patch is here http://marc.theaimsgroup.com/?l=rxtx&m=111084488820288&w=2 I have applied this patch to a local copy but will not be doing formal testing for a couple weeks. I do not try to close ports from inside the eventListenter usually so I encourage any feedback also. If there are no problems reported, I expect this will go into rxtx 2.1-7. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Wed Apr 6 08:33:42 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Wed, 06 Apr 2005 15:33:42 +0100 Subject: [Rxtx] getting RXTX version Message-ID: <4253F346.50102@emation.pt> Hi, I want to make sure my deployments have the same version of RXTX jar and native lib. I know the version of the jar can be obtained in the Version class, but how can I obtain the native version ? I know RXTX prints to the console a warning if the version is different. Is there a way to programatically know is this is the case ? I would like to log that to our app's log thanks Ricardo From taj at www.linux.org.uk Wed Apr 6 15:10:20 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 6 Apr 2005 22:10:20 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4253F346.50102@emation.pt> References: <4253F346.50102@emation.pt> Message-ID: On Wed, 6 Apr 2005, Ricardo Trindade wrote: > Hi, > > I want to make sure my deployments have the same version of RXTX jar > and native lib. > > I know the version of the jar can be obtained in the Version class, > but how can I obtain the native version ? > > I know RXTX prints to the console a warning if the version is > different. Is there a way to programatically know is this is the case ? > > I would like to log that to our app's log > There isn't a suggested way of doing that right now. We could move things around and have a static String RXTXVersion.getNativeVersion() in future releases. Is this what you expected? This is not documented in commapi at all. I just tossed that in to catch conflicts while developing. It would be nice to have access in GUI applications though. It may be possible to access RXTXCommDriver.LibVersion right now. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Thu Apr 7 02:51:00 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 09:51:00 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> Message-ID: <4254F474.7020905@emation.pt> >There isn't a suggested way of doing that right now. We could move things >around and have a static String RXTXVersion.getNativeVersion() in future >releases. Is this what you expected? > > Yes, that would be perfect. >This is not documented in commapi at all. I just tossed that in to catch >conflicts while developing. It would be nice to have access in GUI >applications though. > >It may be possible to access RXTXCommDriver.LibVersion right now. > > > I tried, and I don't think it's possible. From taj at www.linux.org.uk Thu Apr 7 03:32:04 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 7 Apr 2005 10:32:04 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4254F474.7020905@emation.pt> References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: On Thu, 7 Apr 2005, Ricardo Trindade wrote: > > >There isn't a suggested way of doing that right now. We could move things > >around and have a static String RXTXVersion.getNativeVersion() in future > >releases. Is this what you expected? > > > > > > Yes, that would be perfect. > The attached should do what you want. You will still need to catch an exception for older versions... -- Trent Jarvi taj at www.linux.org.uk -------------- next part -------------- ? public_version.patch Index: RXTXCommDriver.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXCommDriver.java,v retrieving revision 1.16.2.51 diff -u -r1.16.2.51 RXTXCommDriver.java --- RXTXCommDriver.java 12 Oct 2004 09:13:30 -0000 1.16.2.51 +++ RXTXCommDriver.java 7 Apr 2005 09:29:04 -0000 @@ -54,7 +54,7 @@ the Library. */ String JarVersion = RXTXVersion.getVersion(); - String LibVersion = nativeGetVersion(); + String LibVersion = RXTXVersion.nativeGetVersion(); if ( devel ) { System.out.println("Devel Library"); @@ -76,7 +76,6 @@ /** Get the Serial port prefixes for the running OS */ private String deviceDirectory; private String osName; - private static native String nativeGetVersion(); private native boolean registerKnownPorts(int PortType); private native boolean isPortPrefixValid(String dev); private native boolean testRead(String dev, int type); Index: RXTXVersion.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXVersion.java,v retrieving revision 1.2.2.31 diff -u -r1.2.2.31 RXTXVersion.java --- RXTXVersion.java 16 Oct 2004 16:20:35 -0000 1.2.2.31 +++ RXTXVersion.java 7 Apr 2005 09:29:04 -0000 @@ -36,6 +36,7 @@ private static String Version; static { + System.loadLibrary( "rxtxSerial" ); Version = "RXTX-2.1-7pre20"; } /** @@ -47,4 +48,5 @@ { return(Version); } + public static native String nativeGetVersion(); } Index: SerialImp.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v retrieving revision 1.46.2.181 diff -u -r1.46.2.181 SerialImp.c --- SerialImp.c 17 Oct 2004 09:48:56 -0000 1.46.2.181 +++ SerialImp.c 7 Apr 2005 09:29:07 -0000 @@ -116,6 +116,7 @@ * It will eventually be removed. * */ #define RXTXPort(foo) Java_gnu_io_RXTXPort_ ## foo +#define RXTXVersion(foo) Java_gnu_io_RXTXVersion_ ## foo #define RXTXCommDriver(foo) Java_gnu_io_RXTXCommDriver_ ## foo #if defined(__sun__) || defined(__hpux__) @@ -4001,7 +4002,7 @@ } /*---------------------------------------------------------- -RXTXCommDriver.nativeGetVersion +RXTXVersion.nativeGetVersion accept: none perform: return the current version @@ -4010,9 +4011,10 @@ comments: This is used to avoid mixing versions of the .jar and native library. First introduced in rxtx-1.5-9 + Moved from RXTXCommDriver to RXTXVersion in rxtx-2.1-7 ----------------------------------------------------------*/ -JNIEXPORT jstring JNICALL RXTXCommDriver(nativeGetVersion) (JNIEnv *env, +JNIEXPORT jstring JNICALL RXTXVersion(nativeGetVersion) (JNIEnv *env, jclass jclazz ) { return (*env)->NewStringUTF( env, "RXTX-2.1-7pre20" ); From ricardo.trindade at emation.pt Thu Apr 7 03:45:58 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 10:45:58 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: <42550156.2040908@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050407/05212451/attachment-0128.html From thomas.shulok at lmco.com Thu Apr 7 17:43:11 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Thu, 07 Apr 2005 19:43:11 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi There, I'm attempting to talk RS232 between an embedded Linux box and a Windows box. Everything connects up fine, and I can send and receive a simple sequence of bytes with no problems. However, if around 5 seconds goes by without me sending something, I get the following when I attempt to send. java.io.IOException: Input/output error in writeArray Stack trace: java/lang/Throwable.()V java/lang/Throwable.(Ljava/lang/String;)V java/io/IOException.(Ljava/lang/String;)V gnu/io/RXTXPort.writeArray([BIIZ)V gnu/io/RXTXPort$SerialOutputStream.write([B)V SerialTest.main([Ljava/lang/String;)V If there interval is shorter (say 2 seconds between sends), I have no problems. On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and librxtxSerial-2.0.7pre2.so. Any ideas? Thanks, Thom -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5b23dcf/attachment-0128.html From taj at www.linux.org.uk Thu Apr 7 19:22:36 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:22:36 +0100 (BST) Subject: [Rxtx] Input/output error in writeArray In-Reply-To: References: Message-ID: On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a Windows > box. Everything connects up fine, and I can send and receive a simple > sequence of bytes with no problems. However, if around 5 seconds goes > by without me sending something, I get the following when I attempt to > send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Apr 7 19:24:59 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:24:59 +0100 (BST) Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) Message-ID: hmm. This would not work from applets would it? -- Trent Jarvi taj at www.linux.org.uk ---------- Forwarded message ---------- Date: Thu, 07 Apr 2005 16:05:53 -0400 From: Chris Gaffney To: taj at www.linux.org.uk Subject: RXTX Libraries on Classpath fix Hi, I submitted a patch for RXTX a few weeks ago to allow for loading the native libraries from the classpath. Since sending it to you I found it wasn't working on windows. I've fixed the problem and created a new patch that should replace the older one. The actual change is a one line from a String.equals() to a String.startsWith(). Thanks for a great piece of software, -Chris Gaffney Grand Valley State University -------------- next part -------------- A non-text attachment was scrubbed... Name: libraries_on_classpath_fixed.patch Type: text/x-patch Size: 5617 bytes Desc: Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5d423b8/libraries_on_classpath_fixed-0128.bin From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From thomas.shulok at lmco.com Fri Apr 8 10:38:55 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Fri, 08 Apr 2005 12:38:55 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi Trent, Thanks for the prompt response. Before diving deeper, I was wondering if there is a timeout parameter somewhere in the stack that I have not set properly. Given the nature of the failure (only fails if the line has been idle for a few seconds), it feels like some kind of timeout issue... Thanks again, Thom -----Original Message----- From: rxtx-bounces at mail.linuxgrrls.org [mailto:rxtx-bounces at mail.linuxgrrls.org] On Behalf Of Trent Jarvi Sent: Thursday, April 07, 2005 6:23 PM To: Java RXTX discussion Subject: Re: [Rxtx] Input/output error in writeArray On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a > Windows box. Everything connects up fine, and I can send and receive > a simple sequence of bytes with no problems. However, if around 5 > seconds goes by without me sending something, I get the following when > I attempt to send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at mail.linuxgrrls.org http://mail.linuxgrrls.org/mailman/listinfo/rxtx From ricardo.trindade at emation.pt Mon Apr 4 09:17:23 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Mon, 04 Apr 2005 16:17:23 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot Message-ID: <42515A83.4050907@emation.pt> Hi, I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most recent stable snapshot), and get the following exception : It looks like rxtx has been compiled with jdk 1.5. If this was indeed the case, I think there is a compilation flag that generates code that runs on older jdks. java.lang.UnsupportedClassVersionError: gnu/io/UnsupportedCommOperationException (Unsupported major.minor version 49.0) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at java.net.URLClassLoader.defineClass(URLClassLoader.java:251) at java.net.URLClassLoader.access$100(URLClassLoader.java:55) at java.net.URLClassLoader$1.run(URLClassLoader.java:194) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:187) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:141) I'm trying to run it with 1.4. thanks Ricardo From taj at www.linux.org.uk Tue Apr 5 00:48:12 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 07:48:12 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42515A83.4050907@emation.pt> References: <42515A83.4050907@emation.pt> Message-ID: On Mon, 4 Apr 2005, Ricardo Trindade wrote: > Hi, > > I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most > recent stable snapshot), and get the following exception : > > It looks like rxtx has been compiled with jdk 1.5. If this was > indeed the case, I think there is a compilation flag that generates code > that runs on older jdks. > > java.lang.UnsupportedClassVersionError: > gnu/io/UnsupportedCommOperationException (Unsupported major.minor > version 49.0) [snip] Thanks Ricardo I recompiled the jar with javac -source 1.3 -target 1.3. That should cover most of the JRE's in use today. I also compiled the rxtx 2.0 x86_64 native library which appeared to be missing. I tried looking for flags to pass gcc 4.0 to make the native libraries more backwards compatible but only found options for C++ which is not used in rxtx. I've got a list of other bugs that I'll be going through in the next few weeks but for now I just left them with the same CVS filename - no code changes. ftp://ftp.qbang.org/pub/rxtx/rxtx-2.0-CVS-20050120-bins.tar.gz ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-CVS-20050120-bins.tar.gz -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Tue Apr 5 02:24:33 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 05 Apr 2005 09:24:33 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: References: <42515A83.4050907@emation.pt> Message-ID: <42524B41.3040300@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050405/5919abbb/attachment-0129.html From taj at www.linux.org.uk Tue Apr 5 03:00:29 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 10:00:29 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42524B41.3040300@emation.pt> References: <42515A83.4050907@emation.pt> <42524B41.3040300@emation.pt> Message-ID: On Tue, 5 Apr 2005, Ricardo Trindade wrote: > Will you anounce to the list when a new release is available ? > There will be several incremental releases announced here. Once those are done, we will release 2.1.7 and 2.0.7. -- Trent Jarvi taj at www.linux.org.uk From no_spam at somewhere.com Tue Apr 5 11:55:37 2005 From: no_spam at somewhere.com (no_spam@somewhere.com) Date: Tue, 5 Apr 2005 13:55:37 -0400 Subject: [Rxtx] Closing a port from an event listener results in a deadlock Message-ID: <20050405175537.GA21747@rcog.homelinux.net> On the message I sent on March 14, does anyone had the chance to try the modification? Or was it already fixed? (I haven't searched the archive extensively) Or maybe my message got catched by some spam filters? (it made it to the list archive though) Anyway, I would appreciate some feedback (through the list) Thanks From taj at www.linux.org.uk Tue Apr 5 14:42:28 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 21:42:28 +0100 (BST) Subject: [Rxtx] Closing a port from an event listener results in a deadlock In-Reply-To: <20050405175537.GA21747@rcog.homelinux.net> References: <20050405175537.GA21747@rcog.homelinux.net> Message-ID: On Tue, 5 Apr 2005 no_spam at somewhere.com wrote: > On the message I sent on March 14, does anyone had the chance to try the > modification? > > Or was it already fixed? (I haven't searched the archive extensively) > > Or maybe my message got catched by some spam filters? (it made it to the list > archive though) > > Anyway, I would appreciate some feedback (through the list) > The patch is here http://marc.theaimsgroup.com/?l=rxtx&m=111084488820288&w=2 I have applied this patch to a local copy but will not be doing formal testing for a couple weeks. I do not try to close ports from inside the eventListenter usually so I encourage any feedback also. If there are no problems reported, I expect this will go into rxtx 2.1-7. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Wed Apr 6 08:33:42 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Wed, 06 Apr 2005 15:33:42 +0100 Subject: [Rxtx] getting RXTX version Message-ID: <4253F346.50102@emation.pt> Hi, I want to make sure my deployments have the same version of RXTX jar and native lib. I know the version of the jar can be obtained in the Version class, but how can I obtain the native version ? I know RXTX prints to the console a warning if the version is different. Is there a way to programatically know is this is the case ? I would like to log that to our app's log thanks Ricardo From taj at www.linux.org.uk Wed Apr 6 15:10:20 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 6 Apr 2005 22:10:20 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4253F346.50102@emation.pt> References: <4253F346.50102@emation.pt> Message-ID: On Wed, 6 Apr 2005, Ricardo Trindade wrote: > Hi, > > I want to make sure my deployments have the same version of RXTX jar > and native lib. > > I know the version of the jar can be obtained in the Version class, > but how can I obtain the native version ? > > I know RXTX prints to the console a warning if the version is > different. Is there a way to programatically know is this is the case ? > > I would like to log that to our app's log > There isn't a suggested way of doing that right now. We could move things around and have a static String RXTXVersion.getNativeVersion() in future releases. Is this what you expected? This is not documented in commapi at all. I just tossed that in to catch conflicts while developing. It would be nice to have access in GUI applications though. It may be possible to access RXTXCommDriver.LibVersion right now. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Thu Apr 7 02:51:00 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 09:51:00 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> Message-ID: <4254F474.7020905@emation.pt> >There isn't a suggested way of doing that right now. We could move things >around and have a static String RXTXVersion.getNativeVersion() in future >releases. Is this what you expected? > > Yes, that would be perfect. >This is not documented in commapi at all. I just tossed that in to catch >conflicts while developing. It would be nice to have access in GUI >applications though. > >It may be possible to access RXTXCommDriver.LibVersion right now. > > > I tried, and I don't think it's possible. From taj at www.linux.org.uk Thu Apr 7 03:32:04 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 7 Apr 2005 10:32:04 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4254F474.7020905@emation.pt> References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: On Thu, 7 Apr 2005, Ricardo Trindade wrote: > > >There isn't a suggested way of doing that right now. We could move things > >around and have a static String RXTXVersion.getNativeVersion() in future > >releases. Is this what you expected? > > > > > > Yes, that would be perfect. > The attached should do what you want. You will still need to catch an exception for older versions... -- Trent Jarvi taj at www.linux.org.uk -------------- next part -------------- ? public_version.patch Index: RXTXCommDriver.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXCommDriver.java,v retrieving revision 1.16.2.51 diff -u -r1.16.2.51 RXTXCommDriver.java --- RXTXCommDriver.java 12 Oct 2004 09:13:30 -0000 1.16.2.51 +++ RXTXCommDriver.java 7 Apr 2005 09:29:04 -0000 @@ -54,7 +54,7 @@ the Library. */ String JarVersion = RXTXVersion.getVersion(); - String LibVersion = nativeGetVersion(); + String LibVersion = RXTXVersion.nativeGetVersion(); if ( devel ) { System.out.println("Devel Library"); @@ -76,7 +76,6 @@ /** Get the Serial port prefixes for the running OS */ private String deviceDirectory; private String osName; - private static native String nativeGetVersion(); private native boolean registerKnownPorts(int PortType); private native boolean isPortPrefixValid(String dev); private native boolean testRead(String dev, int type); Index: RXTXVersion.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXVersion.java,v retrieving revision 1.2.2.31 diff -u -r1.2.2.31 RXTXVersion.java --- RXTXVersion.java 16 Oct 2004 16:20:35 -0000 1.2.2.31 +++ RXTXVersion.java 7 Apr 2005 09:29:04 -0000 @@ -36,6 +36,7 @@ private static String Version; static { + System.loadLibrary( "rxtxSerial" ); Version = "RXTX-2.1-7pre20"; } /** @@ -47,4 +48,5 @@ { return(Version); } + public static native String nativeGetVersion(); } Index: SerialImp.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v retrieving revision 1.46.2.181 diff -u -r1.46.2.181 SerialImp.c --- SerialImp.c 17 Oct 2004 09:48:56 -0000 1.46.2.181 +++ SerialImp.c 7 Apr 2005 09:29:07 -0000 @@ -116,6 +116,7 @@ * It will eventually be removed. * */ #define RXTXPort(foo) Java_gnu_io_RXTXPort_ ## foo +#define RXTXVersion(foo) Java_gnu_io_RXTXVersion_ ## foo #define RXTXCommDriver(foo) Java_gnu_io_RXTXCommDriver_ ## foo #if defined(__sun__) || defined(__hpux__) @@ -4001,7 +4002,7 @@ } /*---------------------------------------------------------- -RXTXCommDriver.nativeGetVersion +RXTXVersion.nativeGetVersion accept: none perform: return the current version @@ -4010,9 +4011,10 @@ comments: This is used to avoid mixing versions of the .jar and native library. First introduced in rxtx-1.5-9 + Moved from RXTXCommDriver to RXTXVersion in rxtx-2.1-7 ----------------------------------------------------------*/ -JNIEXPORT jstring JNICALL RXTXCommDriver(nativeGetVersion) (JNIEnv *env, +JNIEXPORT jstring JNICALL RXTXVersion(nativeGetVersion) (JNIEnv *env, jclass jclazz ) { return (*env)->NewStringUTF( env, "RXTX-2.1-7pre20" ); From ricardo.trindade at emation.pt Thu Apr 7 03:45:58 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 10:45:58 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: <42550156.2040908@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050407/05212451/attachment-0129.html From thomas.shulok at lmco.com Thu Apr 7 17:43:11 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Thu, 07 Apr 2005 19:43:11 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi There, I'm attempting to talk RS232 between an embedded Linux box and a Windows box. Everything connects up fine, and I can send and receive a simple sequence of bytes with no problems. However, if around 5 seconds goes by without me sending something, I get the following when I attempt to send. java.io.IOException: Input/output error in writeArray Stack trace: java/lang/Throwable.()V java/lang/Throwable.(Ljava/lang/String;)V java/io/IOException.(Ljava/lang/String;)V gnu/io/RXTXPort.writeArray([BIIZ)V gnu/io/RXTXPort$SerialOutputStream.write([B)V SerialTest.main([Ljava/lang/String;)V If there interval is shorter (say 2 seconds between sends), I have no problems. On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and librxtxSerial-2.0.7pre2.so. Any ideas? Thanks, Thom -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5b23dcf/attachment-0129.html From taj at www.linux.org.uk Thu Apr 7 19:22:36 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:22:36 +0100 (BST) Subject: [Rxtx] Input/output error in writeArray In-Reply-To: References: Message-ID: On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a Windows > box. Everything connects up fine, and I can send and receive a simple > sequence of bytes with no problems. However, if around 5 seconds goes > by without me sending something, I get the following when I attempt to > send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Apr 7 19:24:59 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:24:59 +0100 (BST) Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) Message-ID: hmm. This would not work from applets would it? -- Trent Jarvi taj at www.linux.org.uk ---------- Forwarded message ---------- Date: Thu, 07 Apr 2005 16:05:53 -0400 From: Chris Gaffney To: taj at www.linux.org.uk Subject: RXTX Libraries on Classpath fix Hi, I submitted a patch for RXTX a few weeks ago to allow for loading the native libraries from the classpath. Since sending it to you I found it wasn't working on windows. I've fixed the problem and created a new patch that should replace the older one. The actual change is a one line from a String.equals() to a String.startsWith(). Thanks for a great piece of software, -Chris Gaffney Grand Valley State University -------------- next part -------------- A non-text attachment was scrubbed... Name: libraries_on_classpath_fixed.patch Type: text/x-patch Size: 5617 bytes Desc: Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5d423b8/libraries_on_classpath_fixed-0129.bin From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From thomas.shulok at lmco.com Fri Apr 8 10:38:55 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Fri, 08 Apr 2005 12:38:55 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi Trent, Thanks for the prompt response. Before diving deeper, I was wondering if there is a timeout parameter somewhere in the stack that I have not set properly. Given the nature of the failure (only fails if the line has been idle for a few seconds), it feels like some kind of timeout issue... Thanks again, Thom -----Original Message----- From: rxtx-bounces at mail.linuxgrrls.org [mailto:rxtx-bounces at mail.linuxgrrls.org] On Behalf Of Trent Jarvi Sent: Thursday, April 07, 2005 6:23 PM To: Java RXTX discussion Subject: Re: [Rxtx] Input/output error in writeArray On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a > Windows box. Everything connects up fine, and I can send and receive > a simple sequence of bytes with no problems. However, if around 5 > seconds goes by without me sending something, I get the following when > I attempt to send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at mail.linuxgrrls.org http://mail.linuxgrrls.org/mailman/listinfo/rxtx From ricardo.trindade at emation.pt Mon Apr 4 09:17:23 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Mon, 04 Apr 2005 16:17:23 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot Message-ID: <42515A83.4050907@emation.pt> Hi, I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most recent stable snapshot), and get the following exception : It looks like rxtx has been compiled with jdk 1.5. If this was indeed the case, I think there is a compilation flag that generates code that runs on older jdks. java.lang.UnsupportedClassVersionError: gnu/io/UnsupportedCommOperationException (Unsupported major.minor version 49.0) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at java.net.URLClassLoader.defineClass(URLClassLoader.java:251) at java.net.URLClassLoader.access$100(URLClassLoader.java:55) at java.net.URLClassLoader$1.run(URLClassLoader.java:194) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:187) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:141) I'm trying to run it with 1.4. thanks Ricardo From taj at www.linux.org.uk Tue Apr 5 00:48:12 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 07:48:12 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42515A83.4050907@emation.pt> References: <42515A83.4050907@emation.pt> Message-ID: On Mon, 4 Apr 2005, Ricardo Trindade wrote: > Hi, > > I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most > recent stable snapshot), and get the following exception : > > It looks like rxtx has been compiled with jdk 1.5. If this was > indeed the case, I think there is a compilation flag that generates code > that runs on older jdks. > > java.lang.UnsupportedClassVersionError: > gnu/io/UnsupportedCommOperationException (Unsupported major.minor > version 49.0) [snip] Thanks Ricardo I recompiled the jar with javac -source 1.3 -target 1.3. That should cover most of the JRE's in use today. I also compiled the rxtx 2.0 x86_64 native library which appeared to be missing. I tried looking for flags to pass gcc 4.0 to make the native libraries more backwards compatible but only found options for C++ which is not used in rxtx. I've got a list of other bugs that I'll be going through in the next few weeks but for now I just left them with the same CVS filename - no code changes. ftp://ftp.qbang.org/pub/rxtx/rxtx-2.0-CVS-20050120-bins.tar.gz ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-CVS-20050120-bins.tar.gz -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Tue Apr 5 02:24:33 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 05 Apr 2005 09:24:33 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: References: <42515A83.4050907@emation.pt> Message-ID: <42524B41.3040300@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050405/5919abbb/attachment-0130.html From taj at www.linux.org.uk Tue Apr 5 03:00:29 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 10:00:29 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42524B41.3040300@emation.pt> References: <42515A83.4050907@emation.pt> <42524B41.3040300@emation.pt> Message-ID: On Tue, 5 Apr 2005, Ricardo Trindade wrote: > Will you anounce to the list when a new release is available ? > There will be several incremental releases announced here. Once those are done, we will release 2.1.7 and 2.0.7. -- Trent Jarvi taj at www.linux.org.uk From no_spam at somewhere.com Tue Apr 5 11:55:37 2005 From: no_spam at somewhere.com (no_spam@somewhere.com) Date: Tue, 5 Apr 2005 13:55:37 -0400 Subject: [Rxtx] Closing a port from an event listener results in a deadlock Message-ID: <20050405175537.GA21747@rcog.homelinux.net> On the message I sent on March 14, does anyone had the chance to try the modification? Or was it already fixed? (I haven't searched the archive extensively) Or maybe my message got catched by some spam filters? (it made it to the list archive though) Anyway, I would appreciate some feedback (through the list) Thanks From taj at www.linux.org.uk Tue Apr 5 14:42:28 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 21:42:28 +0100 (BST) Subject: [Rxtx] Closing a port from an event listener results in a deadlock In-Reply-To: <20050405175537.GA21747@rcog.homelinux.net> References: <20050405175537.GA21747@rcog.homelinux.net> Message-ID: On Tue, 5 Apr 2005 no_spam at somewhere.com wrote: > On the message I sent on March 14, does anyone had the chance to try the > modification? > > Or was it already fixed? (I haven't searched the archive extensively) > > Or maybe my message got catched by some spam filters? (it made it to the list > archive though) > > Anyway, I would appreciate some feedback (through the list) > The patch is here http://marc.theaimsgroup.com/?l=rxtx&m=111084488820288&w=2 I have applied this patch to a local copy but will not be doing formal testing for a couple weeks. I do not try to close ports from inside the eventListenter usually so I encourage any feedback also. If there are no problems reported, I expect this will go into rxtx 2.1-7. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Wed Apr 6 08:33:42 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Wed, 06 Apr 2005 15:33:42 +0100 Subject: [Rxtx] getting RXTX version Message-ID: <4253F346.50102@emation.pt> Hi, I want to make sure my deployments have the same version of RXTX jar and native lib. I know the version of the jar can be obtained in the Version class, but how can I obtain the native version ? I know RXTX prints to the console a warning if the version is different. Is there a way to programatically know is this is the case ? I would like to log that to our app's log thanks Ricardo From taj at www.linux.org.uk Wed Apr 6 15:10:20 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 6 Apr 2005 22:10:20 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4253F346.50102@emation.pt> References: <4253F346.50102@emation.pt> Message-ID: On Wed, 6 Apr 2005, Ricardo Trindade wrote: > Hi, > > I want to make sure my deployments have the same version of RXTX jar > and native lib. > > I know the version of the jar can be obtained in the Version class, > but how can I obtain the native version ? > > I know RXTX prints to the console a warning if the version is > different. Is there a way to programatically know is this is the case ? > > I would like to log that to our app's log > There isn't a suggested way of doing that right now. We could move things around and have a static String RXTXVersion.getNativeVersion() in future releases. Is this what you expected? This is not documented in commapi at all. I just tossed that in to catch conflicts while developing. It would be nice to have access in GUI applications though. It may be possible to access RXTXCommDriver.LibVersion right now. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Thu Apr 7 02:51:00 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 09:51:00 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> Message-ID: <4254F474.7020905@emation.pt> >There isn't a suggested way of doing that right now. We could move things >around and have a static String RXTXVersion.getNativeVersion() in future >releases. Is this what you expected? > > Yes, that would be perfect. >This is not documented in commapi at all. I just tossed that in to catch >conflicts while developing. It would be nice to have access in GUI >applications though. > >It may be possible to access RXTXCommDriver.LibVersion right now. > > > I tried, and I don't think it's possible. From taj at www.linux.org.uk Thu Apr 7 03:32:04 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 7 Apr 2005 10:32:04 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4254F474.7020905@emation.pt> References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: On Thu, 7 Apr 2005, Ricardo Trindade wrote: > > >There isn't a suggested way of doing that right now. We could move things > >around and have a static String RXTXVersion.getNativeVersion() in future > >releases. Is this what you expected? > > > > > > Yes, that would be perfect. > The attached should do what you want. You will still need to catch an exception for older versions... -- Trent Jarvi taj at www.linux.org.uk -------------- next part -------------- ? public_version.patch Index: RXTXCommDriver.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXCommDriver.java,v retrieving revision 1.16.2.51 diff -u -r1.16.2.51 RXTXCommDriver.java --- RXTXCommDriver.java 12 Oct 2004 09:13:30 -0000 1.16.2.51 +++ RXTXCommDriver.java 7 Apr 2005 09:29:04 -0000 @@ -54,7 +54,7 @@ the Library. */ String JarVersion = RXTXVersion.getVersion(); - String LibVersion = nativeGetVersion(); + String LibVersion = RXTXVersion.nativeGetVersion(); if ( devel ) { System.out.println("Devel Library"); @@ -76,7 +76,6 @@ /** Get the Serial port prefixes for the running OS */ private String deviceDirectory; private String osName; - private static native String nativeGetVersion(); private native boolean registerKnownPorts(int PortType); private native boolean isPortPrefixValid(String dev); private native boolean testRead(String dev, int type); Index: RXTXVersion.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXVersion.java,v retrieving revision 1.2.2.31 diff -u -r1.2.2.31 RXTXVersion.java --- RXTXVersion.java 16 Oct 2004 16:20:35 -0000 1.2.2.31 +++ RXTXVersion.java 7 Apr 2005 09:29:04 -0000 @@ -36,6 +36,7 @@ private static String Version; static { + System.loadLibrary( "rxtxSerial" ); Version = "RXTX-2.1-7pre20"; } /** @@ -47,4 +48,5 @@ { return(Version); } + public static native String nativeGetVersion(); } Index: SerialImp.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v retrieving revision 1.46.2.181 diff -u -r1.46.2.181 SerialImp.c --- SerialImp.c 17 Oct 2004 09:48:56 -0000 1.46.2.181 +++ SerialImp.c 7 Apr 2005 09:29:07 -0000 @@ -116,6 +116,7 @@ * It will eventually be removed. * */ #define RXTXPort(foo) Java_gnu_io_RXTXPort_ ## foo +#define RXTXVersion(foo) Java_gnu_io_RXTXVersion_ ## foo #define RXTXCommDriver(foo) Java_gnu_io_RXTXCommDriver_ ## foo #if defined(__sun__) || defined(__hpux__) @@ -4001,7 +4002,7 @@ } /*---------------------------------------------------------- -RXTXCommDriver.nativeGetVersion +RXTXVersion.nativeGetVersion accept: none perform: return the current version @@ -4010,9 +4011,10 @@ comments: This is used to avoid mixing versions of the .jar and native library. First introduced in rxtx-1.5-9 + Moved from RXTXCommDriver to RXTXVersion in rxtx-2.1-7 ----------------------------------------------------------*/ -JNIEXPORT jstring JNICALL RXTXCommDriver(nativeGetVersion) (JNIEnv *env, +JNIEXPORT jstring JNICALL RXTXVersion(nativeGetVersion) (JNIEnv *env, jclass jclazz ) { return (*env)->NewStringUTF( env, "RXTX-2.1-7pre20" ); From ricardo.trindade at emation.pt Thu Apr 7 03:45:58 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 10:45:58 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: <42550156.2040908@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050407/05212451/attachment-0130.html From thomas.shulok at lmco.com Thu Apr 7 17:43:11 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Thu, 07 Apr 2005 19:43:11 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi There, I'm attempting to talk RS232 between an embedded Linux box and a Windows box. Everything connects up fine, and I can send and receive a simple sequence of bytes with no problems. However, if around 5 seconds goes by without me sending something, I get the following when I attempt to send. java.io.IOException: Input/output error in writeArray Stack trace: java/lang/Throwable.()V java/lang/Throwable.(Ljava/lang/String;)V java/io/IOException.(Ljava/lang/String;)V gnu/io/RXTXPort.writeArray([BIIZ)V gnu/io/RXTXPort$SerialOutputStream.write([B)V SerialTest.main([Ljava/lang/String;)V If there interval is shorter (say 2 seconds between sends), I have no problems. On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and librxtxSerial-2.0.7pre2.so. Any ideas? Thanks, Thom -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5b23dcf/attachment-0130.html From taj at www.linux.org.uk Thu Apr 7 19:22:36 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:22:36 +0100 (BST) Subject: [Rxtx] Input/output error in writeArray In-Reply-To: References: Message-ID: On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a Windows > box. Everything connects up fine, and I can send and receive a simple > sequence of bytes with no problems. However, if around 5 seconds goes > by without me sending something, I get the following when I attempt to > send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Apr 7 19:24:59 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:24:59 +0100 (BST) Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) Message-ID: hmm. This would not work from applets would it? -- Trent Jarvi taj at www.linux.org.uk ---------- Forwarded message ---------- Date: Thu, 07 Apr 2005 16:05:53 -0400 From: Chris Gaffney To: taj at www.linux.org.uk Subject: RXTX Libraries on Classpath fix Hi, I submitted a patch for RXTX a few weeks ago to allow for loading the native libraries from the classpath. Since sending it to you I found it wasn't working on windows. I've fixed the problem and created a new patch that should replace the older one. The actual change is a one line from a String.equals() to a String.startsWith(). Thanks for a great piece of software, -Chris Gaffney Grand Valley State University -------------- next part -------------- A non-text attachment was scrubbed... Name: libraries_on_classpath_fixed.patch Type: text/x-patch Size: 5617 bytes Desc: Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5d423b8/libraries_on_classpath_fixed-0130.bin From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From thomas.shulok at lmco.com Fri Apr 8 10:38:55 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Fri, 08 Apr 2005 12:38:55 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi Trent, Thanks for the prompt response. Before diving deeper, I was wondering if there is a timeout parameter somewhere in the stack that I have not set properly. Given the nature of the failure (only fails if the line has been idle for a few seconds), it feels like some kind of timeout issue... Thanks again, Thom -----Original Message----- From: rxtx-bounces at mail.linuxgrrls.org [mailto:rxtx-bounces at mail.linuxgrrls.org] On Behalf Of Trent Jarvi Sent: Thursday, April 07, 2005 6:23 PM To: Java RXTX discussion Subject: Re: [Rxtx] Input/output error in writeArray On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a > Windows box. Everything connects up fine, and I can send and receive > a simple sequence of bytes with no problems. However, if around 5 > seconds goes by without me sending something, I get the following when > I attempt to send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at mail.linuxgrrls.org http://mail.linuxgrrls.org/mailman/listinfo/rxtx From ricardo.trindade at emation.pt Mon Apr 4 09:17:23 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Mon, 04 Apr 2005 16:17:23 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot Message-ID: <42515A83.4050907@emation.pt> Hi, I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most recent stable snapshot), and get the following exception : It looks like rxtx has been compiled with jdk 1.5. If this was indeed the case, I think there is a compilation flag that generates code that runs on older jdks. java.lang.UnsupportedClassVersionError: gnu/io/UnsupportedCommOperationException (Unsupported major.minor version 49.0) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at java.net.URLClassLoader.defineClass(URLClassLoader.java:251) at java.net.URLClassLoader.access$100(URLClassLoader.java:55) at java.net.URLClassLoader$1.run(URLClassLoader.java:194) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:187) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:141) I'm trying to run it with 1.4. thanks Ricardo From taj at www.linux.org.uk Tue Apr 5 00:48:12 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 07:48:12 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42515A83.4050907@emation.pt> References: <42515A83.4050907@emation.pt> Message-ID: On Mon, 4 Apr 2005, Ricardo Trindade wrote: > Hi, > > I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most > recent stable snapshot), and get the following exception : > > It looks like rxtx has been compiled with jdk 1.5. If this was > indeed the case, I think there is a compilation flag that generates code > that runs on older jdks. > > java.lang.UnsupportedClassVersionError: > gnu/io/UnsupportedCommOperationException (Unsupported major.minor > version 49.0) [snip] Thanks Ricardo I recompiled the jar with javac -source 1.3 -target 1.3. That should cover most of the JRE's in use today. I also compiled the rxtx 2.0 x86_64 native library which appeared to be missing. I tried looking for flags to pass gcc 4.0 to make the native libraries more backwards compatible but only found options for C++ which is not used in rxtx. I've got a list of other bugs that I'll be going through in the next few weeks but for now I just left them with the same CVS filename - no code changes. ftp://ftp.qbang.org/pub/rxtx/rxtx-2.0-CVS-20050120-bins.tar.gz ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-CVS-20050120-bins.tar.gz -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Tue Apr 5 02:24:33 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 05 Apr 2005 09:24:33 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: References: <42515A83.4050907@emation.pt> Message-ID: <42524B41.3040300@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050405/5919abbb/attachment-0131.html From taj at www.linux.org.uk Tue Apr 5 03:00:29 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 10:00:29 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42524B41.3040300@emation.pt> References: <42515A83.4050907@emation.pt> <42524B41.3040300@emation.pt> Message-ID: On Tue, 5 Apr 2005, Ricardo Trindade wrote: > Will you anounce to the list when a new release is available ? > There will be several incremental releases announced here. Once those are done, we will release 2.1.7 and 2.0.7. -- Trent Jarvi taj at www.linux.org.uk From no_spam at somewhere.com Tue Apr 5 11:55:37 2005 From: no_spam at somewhere.com (no_spam@somewhere.com) Date: Tue, 5 Apr 2005 13:55:37 -0400 Subject: [Rxtx] Closing a port from an event listener results in a deadlock Message-ID: <20050405175537.GA21747@rcog.homelinux.net> On the message I sent on March 14, does anyone had the chance to try the modification? Or was it already fixed? (I haven't searched the archive extensively) Or maybe my message got catched by some spam filters? (it made it to the list archive though) Anyway, I would appreciate some feedback (through the list) Thanks From taj at www.linux.org.uk Tue Apr 5 14:42:28 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 21:42:28 +0100 (BST) Subject: [Rxtx] Closing a port from an event listener results in a deadlock In-Reply-To: <20050405175537.GA21747@rcog.homelinux.net> References: <20050405175537.GA21747@rcog.homelinux.net> Message-ID: On Tue, 5 Apr 2005 no_spam at somewhere.com wrote: > On the message I sent on March 14, does anyone had the chance to try the > modification? > > Or was it already fixed? (I haven't searched the archive extensively) > > Or maybe my message got catched by some spam filters? (it made it to the list > archive though) > > Anyway, I would appreciate some feedback (through the list) > The patch is here http://marc.theaimsgroup.com/?l=rxtx&m=111084488820288&w=2 I have applied this patch to a local copy but will not be doing formal testing for a couple weeks. I do not try to close ports from inside the eventListenter usually so I encourage any feedback also. If there are no problems reported, I expect this will go into rxtx 2.1-7. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Wed Apr 6 08:33:42 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Wed, 06 Apr 2005 15:33:42 +0100 Subject: [Rxtx] getting RXTX version Message-ID: <4253F346.50102@emation.pt> Hi, I want to make sure my deployments have the same version of RXTX jar and native lib. I know the version of the jar can be obtained in the Version class, but how can I obtain the native version ? I know RXTX prints to the console a warning if the version is different. Is there a way to programatically know is this is the case ? I would like to log that to our app's log thanks Ricardo From taj at www.linux.org.uk Wed Apr 6 15:10:20 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 6 Apr 2005 22:10:20 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4253F346.50102@emation.pt> References: <4253F346.50102@emation.pt> Message-ID: On Wed, 6 Apr 2005, Ricardo Trindade wrote: > Hi, > > I want to make sure my deployments have the same version of RXTX jar > and native lib. > > I know the version of the jar can be obtained in the Version class, > but how can I obtain the native version ? > > I know RXTX prints to the console a warning if the version is > different. Is there a way to programatically know is this is the case ? > > I would like to log that to our app's log > There isn't a suggested way of doing that right now. We could move things around and have a static String RXTXVersion.getNativeVersion() in future releases. Is this what you expected? This is not documented in commapi at all. I just tossed that in to catch conflicts while developing. It would be nice to have access in GUI applications though. It may be possible to access RXTXCommDriver.LibVersion right now. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Thu Apr 7 02:51:00 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 09:51:00 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> Message-ID: <4254F474.7020905@emation.pt> >There isn't a suggested way of doing that right now. We could move things >around and have a static String RXTXVersion.getNativeVersion() in future >releases. Is this what you expected? > > Yes, that would be perfect. >This is not documented in commapi at all. I just tossed that in to catch >conflicts while developing. It would be nice to have access in GUI >applications though. > >It may be possible to access RXTXCommDriver.LibVersion right now. > > > I tried, and I don't think it's possible. From taj at www.linux.org.uk Thu Apr 7 03:32:04 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 7 Apr 2005 10:32:04 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4254F474.7020905@emation.pt> References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: On Thu, 7 Apr 2005, Ricardo Trindade wrote: > > >There isn't a suggested way of doing that right now. We could move things > >around and have a static String RXTXVersion.getNativeVersion() in future > >releases. Is this what you expected? > > > > > > Yes, that would be perfect. > The attached should do what you want. You will still need to catch an exception for older versions... -- Trent Jarvi taj at www.linux.org.uk -------------- next part -------------- ? public_version.patch Index: RXTXCommDriver.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXCommDriver.java,v retrieving revision 1.16.2.51 diff -u -r1.16.2.51 RXTXCommDriver.java --- RXTXCommDriver.java 12 Oct 2004 09:13:30 -0000 1.16.2.51 +++ RXTXCommDriver.java 7 Apr 2005 09:29:04 -0000 @@ -54,7 +54,7 @@ the Library. */ String JarVersion = RXTXVersion.getVersion(); - String LibVersion = nativeGetVersion(); + String LibVersion = RXTXVersion.nativeGetVersion(); if ( devel ) { System.out.println("Devel Library"); @@ -76,7 +76,6 @@ /** Get the Serial port prefixes for the running OS */ private String deviceDirectory; private String osName; - private static native String nativeGetVersion(); private native boolean registerKnownPorts(int PortType); private native boolean isPortPrefixValid(String dev); private native boolean testRead(String dev, int type); Index: RXTXVersion.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXVersion.java,v retrieving revision 1.2.2.31 diff -u -r1.2.2.31 RXTXVersion.java --- RXTXVersion.java 16 Oct 2004 16:20:35 -0000 1.2.2.31 +++ RXTXVersion.java 7 Apr 2005 09:29:04 -0000 @@ -36,6 +36,7 @@ private static String Version; static { + System.loadLibrary( "rxtxSerial" ); Version = "RXTX-2.1-7pre20"; } /** @@ -47,4 +48,5 @@ { return(Version); } + public static native String nativeGetVersion(); } Index: SerialImp.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v retrieving revision 1.46.2.181 diff -u -r1.46.2.181 SerialImp.c --- SerialImp.c 17 Oct 2004 09:48:56 -0000 1.46.2.181 +++ SerialImp.c 7 Apr 2005 09:29:07 -0000 @@ -116,6 +116,7 @@ * It will eventually be removed. * */ #define RXTXPort(foo) Java_gnu_io_RXTXPort_ ## foo +#define RXTXVersion(foo) Java_gnu_io_RXTXVersion_ ## foo #define RXTXCommDriver(foo) Java_gnu_io_RXTXCommDriver_ ## foo #if defined(__sun__) || defined(__hpux__) @@ -4001,7 +4002,7 @@ } /*---------------------------------------------------------- -RXTXCommDriver.nativeGetVersion +RXTXVersion.nativeGetVersion accept: none perform: return the current version @@ -4010,9 +4011,10 @@ comments: This is used to avoid mixing versions of the .jar and native library. First introduced in rxtx-1.5-9 + Moved from RXTXCommDriver to RXTXVersion in rxtx-2.1-7 ----------------------------------------------------------*/ -JNIEXPORT jstring JNICALL RXTXCommDriver(nativeGetVersion) (JNIEnv *env, +JNIEXPORT jstring JNICALL RXTXVersion(nativeGetVersion) (JNIEnv *env, jclass jclazz ) { return (*env)->NewStringUTF( env, "RXTX-2.1-7pre20" ); From ricardo.trindade at emation.pt Thu Apr 7 03:45:58 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 10:45:58 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: <42550156.2040908@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050407/05212451/attachment-0131.html From thomas.shulok at lmco.com Thu Apr 7 17:43:11 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Thu, 07 Apr 2005 19:43:11 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi There, I'm attempting to talk RS232 between an embedded Linux box and a Windows box. Everything connects up fine, and I can send and receive a simple sequence of bytes with no problems. However, if around 5 seconds goes by without me sending something, I get the following when I attempt to send. java.io.IOException: Input/output error in writeArray Stack trace: java/lang/Throwable.()V java/lang/Throwable.(Ljava/lang/String;)V java/io/IOException.(Ljava/lang/String;)V gnu/io/RXTXPort.writeArray([BIIZ)V gnu/io/RXTXPort$SerialOutputStream.write([B)V SerialTest.main([Ljava/lang/String;)V If there interval is shorter (say 2 seconds between sends), I have no problems. On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and librxtxSerial-2.0.7pre2.so. Any ideas? Thanks, Thom -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5b23dcf/attachment-0131.html From taj at www.linux.org.uk Thu Apr 7 19:22:36 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:22:36 +0100 (BST) Subject: [Rxtx] Input/output error in writeArray In-Reply-To: References: Message-ID: On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a Windows > box. Everything connects up fine, and I can send and receive a simple > sequence of bytes with no problems. However, if around 5 seconds goes > by without me sending something, I get the following when I attempt to > send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Apr 7 19:24:59 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:24:59 +0100 (BST) Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) Message-ID: hmm. This would not work from applets would it? -- Trent Jarvi taj at www.linux.org.uk ---------- Forwarded message ---------- Date: Thu, 07 Apr 2005 16:05:53 -0400 From: Chris Gaffney To: taj at www.linux.org.uk Subject: RXTX Libraries on Classpath fix Hi, I submitted a patch for RXTX a few weeks ago to allow for loading the native libraries from the classpath. Since sending it to you I found it wasn't working on windows. I've fixed the problem and created a new patch that should replace the older one. The actual change is a one line from a String.equals() to a String.startsWith(). Thanks for a great piece of software, -Chris Gaffney Grand Valley State University -------------- next part -------------- A non-text attachment was scrubbed... Name: libraries_on_classpath_fixed.patch Type: text/x-patch Size: 5617 bytes Desc: Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5d423b8/libraries_on_classpath_fixed-0131.bin From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From thomas.shulok at lmco.com Fri Apr 8 10:38:55 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Fri, 08 Apr 2005 12:38:55 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi Trent, Thanks for the prompt response. Before diving deeper, I was wondering if there is a timeout parameter somewhere in the stack that I have not set properly. Given the nature of the failure (only fails if the line has been idle for a few seconds), it feels like some kind of timeout issue... Thanks again, Thom -----Original Message----- From: rxtx-bounces at mail.linuxgrrls.org [mailto:rxtx-bounces at mail.linuxgrrls.org] On Behalf Of Trent Jarvi Sent: Thursday, April 07, 2005 6:23 PM To: Java RXTX discussion Subject: Re: [Rxtx] Input/output error in writeArray On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a > Windows box. Everything connects up fine, and I can send and receive > a simple sequence of bytes with no problems. However, if around 5 > seconds goes by without me sending something, I get the following when > I attempt to send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at mail.linuxgrrls.org http://mail.linuxgrrls.org/mailman/listinfo/rxtx From ricardo.trindade at emation.pt Mon Apr 4 09:17:23 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Mon, 04 Apr 2005 16:17:23 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot Message-ID: <42515A83.4050907@emation.pt> Hi, I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most recent stable snapshot), and get the following exception : It looks like rxtx has been compiled with jdk 1.5. If this was indeed the case, I think there is a compilation flag that generates code that runs on older jdks. java.lang.UnsupportedClassVersionError: gnu/io/UnsupportedCommOperationException (Unsupported major.minor version 49.0) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at java.net.URLClassLoader.defineClass(URLClassLoader.java:251) at java.net.URLClassLoader.access$100(URLClassLoader.java:55) at java.net.URLClassLoader$1.run(URLClassLoader.java:194) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:187) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:141) I'm trying to run it with 1.4. thanks Ricardo From taj at www.linux.org.uk Tue Apr 5 00:48:12 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 07:48:12 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42515A83.4050907@emation.pt> References: <42515A83.4050907@emation.pt> Message-ID: On Mon, 4 Apr 2005, Ricardo Trindade wrote: > Hi, > > I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most > recent stable snapshot), and get the following exception : > > It looks like rxtx has been compiled with jdk 1.5. If this was > indeed the case, I think there is a compilation flag that generates code > that runs on older jdks. > > java.lang.UnsupportedClassVersionError: > gnu/io/UnsupportedCommOperationException (Unsupported major.minor > version 49.0) [snip] Thanks Ricardo I recompiled the jar with javac -source 1.3 -target 1.3. That should cover most of the JRE's in use today. I also compiled the rxtx 2.0 x86_64 native library which appeared to be missing. I tried looking for flags to pass gcc 4.0 to make the native libraries more backwards compatible but only found options for C++ which is not used in rxtx. I've got a list of other bugs that I'll be going through in the next few weeks but for now I just left them with the same CVS filename - no code changes. ftp://ftp.qbang.org/pub/rxtx/rxtx-2.0-CVS-20050120-bins.tar.gz ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-CVS-20050120-bins.tar.gz -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Tue Apr 5 02:24:33 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 05 Apr 2005 09:24:33 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: References: <42515A83.4050907@emation.pt> Message-ID: <42524B41.3040300@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050405/5919abbb/attachment-0132.html From taj at www.linux.org.uk Tue Apr 5 03:00:29 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 10:00:29 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42524B41.3040300@emation.pt> References: <42515A83.4050907@emation.pt> <42524B41.3040300@emation.pt> Message-ID: On Tue, 5 Apr 2005, Ricardo Trindade wrote: > Will you anounce to the list when a new release is available ? > There will be several incremental releases announced here. Once those are done, we will release 2.1.7 and 2.0.7. -- Trent Jarvi taj at www.linux.org.uk From no_spam at somewhere.com Tue Apr 5 11:55:37 2005 From: no_spam at somewhere.com (no_spam@somewhere.com) Date: Tue, 5 Apr 2005 13:55:37 -0400 Subject: [Rxtx] Closing a port from an event listener results in a deadlock Message-ID: <20050405175537.GA21747@rcog.homelinux.net> On the message I sent on March 14, does anyone had the chance to try the modification? Or was it already fixed? (I haven't searched the archive extensively) Or maybe my message got catched by some spam filters? (it made it to the list archive though) Anyway, I would appreciate some feedback (through the list) Thanks From taj at www.linux.org.uk Tue Apr 5 14:42:28 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 21:42:28 +0100 (BST) Subject: [Rxtx] Closing a port from an event listener results in a deadlock In-Reply-To: <20050405175537.GA21747@rcog.homelinux.net> References: <20050405175537.GA21747@rcog.homelinux.net> Message-ID: On Tue, 5 Apr 2005 no_spam at somewhere.com wrote: > On the message I sent on March 14, does anyone had the chance to try the > modification? > > Or was it already fixed? (I haven't searched the archive extensively) > > Or maybe my message got catched by some spam filters? (it made it to the list > archive though) > > Anyway, I would appreciate some feedback (through the list) > The patch is here http://marc.theaimsgroup.com/?l=rxtx&m=111084488820288&w=2 I have applied this patch to a local copy but will not be doing formal testing for a couple weeks. I do not try to close ports from inside the eventListenter usually so I encourage any feedback also. If there are no problems reported, I expect this will go into rxtx 2.1-7. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Wed Apr 6 08:33:42 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Wed, 06 Apr 2005 15:33:42 +0100 Subject: [Rxtx] getting RXTX version Message-ID: <4253F346.50102@emation.pt> Hi, I want to make sure my deployments have the same version of RXTX jar and native lib. I know the version of the jar can be obtained in the Version class, but how can I obtain the native version ? I know RXTX prints to the console a warning if the version is different. Is there a way to programatically know is this is the case ? I would like to log that to our app's log thanks Ricardo From taj at www.linux.org.uk Wed Apr 6 15:10:20 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 6 Apr 2005 22:10:20 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4253F346.50102@emation.pt> References: <4253F346.50102@emation.pt> Message-ID: On Wed, 6 Apr 2005, Ricardo Trindade wrote: > Hi, > > I want to make sure my deployments have the same version of RXTX jar > and native lib. > > I know the version of the jar can be obtained in the Version class, > but how can I obtain the native version ? > > I know RXTX prints to the console a warning if the version is > different. Is there a way to programatically know is this is the case ? > > I would like to log that to our app's log > There isn't a suggested way of doing that right now. We could move things around and have a static String RXTXVersion.getNativeVersion() in future releases. Is this what you expected? This is not documented in commapi at all. I just tossed that in to catch conflicts while developing. It would be nice to have access in GUI applications though. It may be possible to access RXTXCommDriver.LibVersion right now. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Thu Apr 7 02:51:00 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 09:51:00 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> Message-ID: <4254F474.7020905@emation.pt> >There isn't a suggested way of doing that right now. We could move things >around and have a static String RXTXVersion.getNativeVersion() in future >releases. Is this what you expected? > > Yes, that would be perfect. >This is not documented in commapi at all. I just tossed that in to catch >conflicts while developing. It would be nice to have access in GUI >applications though. > >It may be possible to access RXTXCommDriver.LibVersion right now. > > > I tried, and I don't think it's possible. From taj at www.linux.org.uk Thu Apr 7 03:32:04 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 7 Apr 2005 10:32:04 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4254F474.7020905@emation.pt> References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: On Thu, 7 Apr 2005, Ricardo Trindade wrote: > > >There isn't a suggested way of doing that right now. We could move things > >around and have a static String RXTXVersion.getNativeVersion() in future > >releases. Is this what you expected? > > > > > > Yes, that would be perfect. > The attached should do what you want. You will still need to catch an exception for older versions... -- Trent Jarvi taj at www.linux.org.uk -------------- next part -------------- ? public_version.patch Index: RXTXCommDriver.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXCommDriver.java,v retrieving revision 1.16.2.51 diff -u -r1.16.2.51 RXTXCommDriver.java --- RXTXCommDriver.java 12 Oct 2004 09:13:30 -0000 1.16.2.51 +++ RXTXCommDriver.java 7 Apr 2005 09:29:04 -0000 @@ -54,7 +54,7 @@ the Library. */ String JarVersion = RXTXVersion.getVersion(); - String LibVersion = nativeGetVersion(); + String LibVersion = RXTXVersion.nativeGetVersion(); if ( devel ) { System.out.println("Devel Library"); @@ -76,7 +76,6 @@ /** Get the Serial port prefixes for the running OS */ private String deviceDirectory; private String osName; - private static native String nativeGetVersion(); private native boolean registerKnownPorts(int PortType); private native boolean isPortPrefixValid(String dev); private native boolean testRead(String dev, int type); Index: RXTXVersion.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXVersion.java,v retrieving revision 1.2.2.31 diff -u -r1.2.2.31 RXTXVersion.java --- RXTXVersion.java 16 Oct 2004 16:20:35 -0000 1.2.2.31 +++ RXTXVersion.java 7 Apr 2005 09:29:04 -0000 @@ -36,6 +36,7 @@ private static String Version; static { + System.loadLibrary( "rxtxSerial" ); Version = "RXTX-2.1-7pre20"; } /** @@ -47,4 +48,5 @@ { return(Version); } + public static native String nativeGetVersion(); } Index: SerialImp.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v retrieving revision 1.46.2.181 diff -u -r1.46.2.181 SerialImp.c --- SerialImp.c 17 Oct 2004 09:48:56 -0000 1.46.2.181 +++ SerialImp.c 7 Apr 2005 09:29:07 -0000 @@ -116,6 +116,7 @@ * It will eventually be removed. * */ #define RXTXPort(foo) Java_gnu_io_RXTXPort_ ## foo +#define RXTXVersion(foo) Java_gnu_io_RXTXVersion_ ## foo #define RXTXCommDriver(foo) Java_gnu_io_RXTXCommDriver_ ## foo #if defined(__sun__) || defined(__hpux__) @@ -4001,7 +4002,7 @@ } /*---------------------------------------------------------- -RXTXCommDriver.nativeGetVersion +RXTXVersion.nativeGetVersion accept: none perform: return the current version @@ -4010,9 +4011,10 @@ comments: This is used to avoid mixing versions of the .jar and native library. First introduced in rxtx-1.5-9 + Moved from RXTXCommDriver to RXTXVersion in rxtx-2.1-7 ----------------------------------------------------------*/ -JNIEXPORT jstring JNICALL RXTXCommDriver(nativeGetVersion) (JNIEnv *env, +JNIEXPORT jstring JNICALL RXTXVersion(nativeGetVersion) (JNIEnv *env, jclass jclazz ) { return (*env)->NewStringUTF( env, "RXTX-2.1-7pre20" ); From ricardo.trindade at emation.pt Thu Apr 7 03:45:58 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 10:45:58 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: <42550156.2040908@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050407/05212451/attachment-0132.html From thomas.shulok at lmco.com Thu Apr 7 17:43:11 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Thu, 07 Apr 2005 19:43:11 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi There, I'm attempting to talk RS232 between an embedded Linux box and a Windows box. Everything connects up fine, and I can send and receive a simple sequence of bytes with no problems. However, if around 5 seconds goes by without me sending something, I get the following when I attempt to send. java.io.IOException: Input/output error in writeArray Stack trace: java/lang/Throwable.()V java/lang/Throwable.(Ljava/lang/String;)V java/io/IOException.(Ljava/lang/String;)V gnu/io/RXTXPort.writeArray([BIIZ)V gnu/io/RXTXPort$SerialOutputStream.write([B)V SerialTest.main([Ljava/lang/String;)V If there interval is shorter (say 2 seconds between sends), I have no problems. On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and librxtxSerial-2.0.7pre2.so. Any ideas? Thanks, Thom -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5b23dcf/attachment-0132.html From taj at www.linux.org.uk Thu Apr 7 19:22:36 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:22:36 +0100 (BST) Subject: [Rxtx] Input/output error in writeArray In-Reply-To: References: Message-ID: On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a Windows > box. Everything connects up fine, and I can send and receive a simple > sequence of bytes with no problems. However, if around 5 seconds goes > by without me sending something, I get the following when I attempt to > send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Apr 7 19:24:59 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:24:59 +0100 (BST) Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) Message-ID: hmm. This would not work from applets would it? -- Trent Jarvi taj at www.linux.org.uk ---------- Forwarded message ---------- Date: Thu, 07 Apr 2005 16:05:53 -0400 From: Chris Gaffney To: taj at www.linux.org.uk Subject: RXTX Libraries on Classpath fix Hi, I submitted a patch for RXTX a few weeks ago to allow for loading the native libraries from the classpath. Since sending it to you I found it wasn't working on windows. I've fixed the problem and created a new patch that should replace the older one. The actual change is a one line from a String.equals() to a String.startsWith(). Thanks for a great piece of software, -Chris Gaffney Grand Valley State University -------------- next part -------------- A non-text attachment was scrubbed... Name: libraries_on_classpath_fixed.patch Type: text/x-patch Size: 5617 bytes Desc: Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5d423b8/libraries_on_classpath_fixed-0132.bin From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From thomas.shulok at lmco.com Fri Apr 8 10:38:55 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Fri, 08 Apr 2005 12:38:55 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi Trent, Thanks for the prompt response. Before diving deeper, I was wondering if there is a timeout parameter somewhere in the stack that I have not set properly. Given the nature of the failure (only fails if the line has been idle for a few seconds), it feels like some kind of timeout issue... Thanks again, Thom -----Original Message----- From: rxtx-bounces at mail.linuxgrrls.org [mailto:rxtx-bounces at mail.linuxgrrls.org] On Behalf Of Trent Jarvi Sent: Thursday, April 07, 2005 6:23 PM To: Java RXTX discussion Subject: Re: [Rxtx] Input/output error in writeArray On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a > Windows box. Everything connects up fine, and I can send and receive > a simple sequence of bytes with no problems. However, if around 5 > seconds goes by without me sending something, I get the following when > I attempt to send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at mail.linuxgrrls.org http://mail.linuxgrrls.org/mailman/listinfo/rxtx From ricardo.trindade at emation.pt Mon Apr 4 09:17:23 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Mon, 04 Apr 2005 16:17:23 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot Message-ID: <42515A83.4050907@emation.pt> Hi, I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most recent stable snapshot), and get the following exception : It looks like rxtx has been compiled with jdk 1.5. If this was indeed the case, I think there is a compilation flag that generates code that runs on older jdks. java.lang.UnsupportedClassVersionError: gnu/io/UnsupportedCommOperationException (Unsupported major.minor version 49.0) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at java.net.URLClassLoader.defineClass(URLClassLoader.java:251) at java.net.URLClassLoader.access$100(URLClassLoader.java:55) at java.net.URLClassLoader$1.run(URLClassLoader.java:194) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:187) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:141) I'm trying to run it with 1.4. thanks Ricardo From taj at www.linux.org.uk Tue Apr 5 00:48:12 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 07:48:12 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42515A83.4050907@emation.pt> References: <42515A83.4050907@emation.pt> Message-ID: On Mon, 4 Apr 2005, Ricardo Trindade wrote: > Hi, > > I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most > recent stable snapshot), and get the following exception : > > It looks like rxtx has been compiled with jdk 1.5. If this was > indeed the case, I think there is a compilation flag that generates code > that runs on older jdks. > > java.lang.UnsupportedClassVersionError: > gnu/io/UnsupportedCommOperationException (Unsupported major.minor > version 49.0) [snip] Thanks Ricardo I recompiled the jar with javac -source 1.3 -target 1.3. That should cover most of the JRE's in use today. I also compiled the rxtx 2.0 x86_64 native library which appeared to be missing. I tried looking for flags to pass gcc 4.0 to make the native libraries more backwards compatible but only found options for C++ which is not used in rxtx. I've got a list of other bugs that I'll be going through in the next few weeks but for now I just left them with the same CVS filename - no code changes. ftp://ftp.qbang.org/pub/rxtx/rxtx-2.0-CVS-20050120-bins.tar.gz ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-CVS-20050120-bins.tar.gz -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Tue Apr 5 02:24:33 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 05 Apr 2005 09:24:33 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: References: <42515A83.4050907@emation.pt> Message-ID: <42524B41.3040300@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050405/5919abbb/attachment-0133.html From taj at www.linux.org.uk Tue Apr 5 03:00:29 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 10:00:29 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42524B41.3040300@emation.pt> References: <42515A83.4050907@emation.pt> <42524B41.3040300@emation.pt> Message-ID: On Tue, 5 Apr 2005, Ricardo Trindade wrote: > Will you anounce to the list when a new release is available ? > There will be several incremental releases announced here. Once those are done, we will release 2.1.7 and 2.0.7. -- Trent Jarvi taj at www.linux.org.uk From no_spam at somewhere.com Tue Apr 5 11:55:37 2005 From: no_spam at somewhere.com (no_spam@somewhere.com) Date: Tue, 5 Apr 2005 13:55:37 -0400 Subject: [Rxtx] Closing a port from an event listener results in a deadlock Message-ID: <20050405175537.GA21747@rcog.homelinux.net> On the message I sent on March 14, does anyone had the chance to try the modification? Or was it already fixed? (I haven't searched the archive extensively) Or maybe my message got catched by some spam filters? (it made it to the list archive though) Anyway, I would appreciate some feedback (through the list) Thanks From taj at www.linux.org.uk Tue Apr 5 14:42:28 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 21:42:28 +0100 (BST) Subject: [Rxtx] Closing a port from an event listener results in a deadlock In-Reply-To: <20050405175537.GA21747@rcog.homelinux.net> References: <20050405175537.GA21747@rcog.homelinux.net> Message-ID: On Tue, 5 Apr 2005 no_spam at somewhere.com wrote: > On the message I sent on March 14, does anyone had the chance to try the > modification? > > Or was it already fixed? (I haven't searched the archive extensively) > > Or maybe my message got catched by some spam filters? (it made it to the list > archive though) > > Anyway, I would appreciate some feedback (through the list) > The patch is here http://marc.theaimsgroup.com/?l=rxtx&m=111084488820288&w=2 I have applied this patch to a local copy but will not be doing formal testing for a couple weeks. I do not try to close ports from inside the eventListenter usually so I encourage any feedback also. If there are no problems reported, I expect this will go into rxtx 2.1-7. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Wed Apr 6 08:33:42 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Wed, 06 Apr 2005 15:33:42 +0100 Subject: [Rxtx] getting RXTX version Message-ID: <4253F346.50102@emation.pt> Hi, I want to make sure my deployments have the same version of RXTX jar and native lib. I know the version of the jar can be obtained in the Version class, but how can I obtain the native version ? I know RXTX prints to the console a warning if the version is different. Is there a way to programatically know is this is the case ? I would like to log that to our app's log thanks Ricardo From taj at www.linux.org.uk Wed Apr 6 15:10:20 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 6 Apr 2005 22:10:20 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4253F346.50102@emation.pt> References: <4253F346.50102@emation.pt> Message-ID: On Wed, 6 Apr 2005, Ricardo Trindade wrote: > Hi, > > I want to make sure my deployments have the same version of RXTX jar > and native lib. > > I know the version of the jar can be obtained in the Version class, > but how can I obtain the native version ? > > I know RXTX prints to the console a warning if the version is > different. Is there a way to programatically know is this is the case ? > > I would like to log that to our app's log > There isn't a suggested way of doing that right now. We could move things around and have a static String RXTXVersion.getNativeVersion() in future releases. Is this what you expected? This is not documented in commapi at all. I just tossed that in to catch conflicts while developing. It would be nice to have access in GUI applications though. It may be possible to access RXTXCommDriver.LibVersion right now. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Thu Apr 7 02:51:00 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 09:51:00 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> Message-ID: <4254F474.7020905@emation.pt> >There isn't a suggested way of doing that right now. We could move things >around and have a static String RXTXVersion.getNativeVersion() in future >releases. Is this what you expected? > > Yes, that would be perfect. >This is not documented in commapi at all. I just tossed that in to catch >conflicts while developing. It would be nice to have access in GUI >applications though. > >It may be possible to access RXTXCommDriver.LibVersion right now. > > > I tried, and I don't think it's possible. From taj at www.linux.org.uk Thu Apr 7 03:32:04 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 7 Apr 2005 10:32:04 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4254F474.7020905@emation.pt> References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: On Thu, 7 Apr 2005, Ricardo Trindade wrote: > > >There isn't a suggested way of doing that right now. We could move things > >around and have a static String RXTXVersion.getNativeVersion() in future > >releases. Is this what you expected? > > > > > > Yes, that would be perfect. > The attached should do what you want. You will still need to catch an exception for older versions... -- Trent Jarvi taj at www.linux.org.uk -------------- next part -------------- ? public_version.patch Index: RXTXCommDriver.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXCommDriver.java,v retrieving revision 1.16.2.51 diff -u -r1.16.2.51 RXTXCommDriver.java --- RXTXCommDriver.java 12 Oct 2004 09:13:30 -0000 1.16.2.51 +++ RXTXCommDriver.java 7 Apr 2005 09:29:04 -0000 @@ -54,7 +54,7 @@ the Library. */ String JarVersion = RXTXVersion.getVersion(); - String LibVersion = nativeGetVersion(); + String LibVersion = RXTXVersion.nativeGetVersion(); if ( devel ) { System.out.println("Devel Library"); @@ -76,7 +76,6 @@ /** Get the Serial port prefixes for the running OS */ private String deviceDirectory; private String osName; - private static native String nativeGetVersion(); private native boolean registerKnownPorts(int PortType); private native boolean isPortPrefixValid(String dev); private native boolean testRead(String dev, int type); Index: RXTXVersion.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXVersion.java,v retrieving revision 1.2.2.31 diff -u -r1.2.2.31 RXTXVersion.java --- RXTXVersion.java 16 Oct 2004 16:20:35 -0000 1.2.2.31 +++ RXTXVersion.java 7 Apr 2005 09:29:04 -0000 @@ -36,6 +36,7 @@ private static String Version; static { + System.loadLibrary( "rxtxSerial" ); Version = "RXTX-2.1-7pre20"; } /** @@ -47,4 +48,5 @@ { return(Version); } + public static native String nativeGetVersion(); } Index: SerialImp.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v retrieving revision 1.46.2.181 diff -u -r1.46.2.181 SerialImp.c --- SerialImp.c 17 Oct 2004 09:48:56 -0000 1.46.2.181 +++ SerialImp.c 7 Apr 2005 09:29:07 -0000 @@ -116,6 +116,7 @@ * It will eventually be removed. * */ #define RXTXPort(foo) Java_gnu_io_RXTXPort_ ## foo +#define RXTXVersion(foo) Java_gnu_io_RXTXVersion_ ## foo #define RXTXCommDriver(foo) Java_gnu_io_RXTXCommDriver_ ## foo #if defined(__sun__) || defined(__hpux__) @@ -4001,7 +4002,7 @@ } /*---------------------------------------------------------- -RXTXCommDriver.nativeGetVersion +RXTXVersion.nativeGetVersion accept: none perform: return the current version @@ -4010,9 +4011,10 @@ comments: This is used to avoid mixing versions of the .jar and native library. First introduced in rxtx-1.5-9 + Moved from RXTXCommDriver to RXTXVersion in rxtx-2.1-7 ----------------------------------------------------------*/ -JNIEXPORT jstring JNICALL RXTXCommDriver(nativeGetVersion) (JNIEnv *env, +JNIEXPORT jstring JNICALL RXTXVersion(nativeGetVersion) (JNIEnv *env, jclass jclazz ) { return (*env)->NewStringUTF( env, "RXTX-2.1-7pre20" ); From ricardo.trindade at emation.pt Thu Apr 7 03:45:58 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 10:45:58 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: <42550156.2040908@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050407/05212451/attachment-0133.html From thomas.shulok at lmco.com Thu Apr 7 17:43:11 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Thu, 07 Apr 2005 19:43:11 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi There, I'm attempting to talk RS232 between an embedded Linux box and a Windows box. Everything connects up fine, and I can send and receive a simple sequence of bytes with no problems. However, if around 5 seconds goes by without me sending something, I get the following when I attempt to send. java.io.IOException: Input/output error in writeArray Stack trace: java/lang/Throwable.()V java/lang/Throwable.(Ljava/lang/String;)V java/io/IOException.(Ljava/lang/String;)V gnu/io/RXTXPort.writeArray([BIIZ)V gnu/io/RXTXPort$SerialOutputStream.write([B)V SerialTest.main([Ljava/lang/String;)V If there interval is shorter (say 2 seconds between sends), I have no problems. On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and librxtxSerial-2.0.7pre2.so. Any ideas? Thanks, Thom -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5b23dcf/attachment-0133.html From taj at www.linux.org.uk Thu Apr 7 19:22:36 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:22:36 +0100 (BST) Subject: [Rxtx] Input/output error in writeArray In-Reply-To: References: Message-ID: On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a Windows > box. Everything connects up fine, and I can send and receive a simple > sequence of bytes with no problems. However, if around 5 seconds goes > by without me sending something, I get the following when I attempt to > send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Apr 7 19:24:59 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:24:59 +0100 (BST) Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) Message-ID: hmm. This would not work from applets would it? -- Trent Jarvi taj at www.linux.org.uk ---------- Forwarded message ---------- Date: Thu, 07 Apr 2005 16:05:53 -0400 From: Chris Gaffney To: taj at www.linux.org.uk Subject: RXTX Libraries on Classpath fix Hi, I submitted a patch for RXTX a few weeks ago to allow for loading the native libraries from the classpath. Since sending it to you I found it wasn't working on windows. I've fixed the problem and created a new patch that should replace the older one. The actual change is a one line from a String.equals() to a String.startsWith(). Thanks for a great piece of software, -Chris Gaffney Grand Valley State University -------------- next part -------------- A non-text attachment was scrubbed... Name: libraries_on_classpath_fixed.patch Type: text/x-patch Size: 5617 bytes Desc: Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5d423b8/libraries_on_classpath_fixed-0133.bin From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From thomas.shulok at lmco.com Fri Apr 8 10:38:55 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Fri, 08 Apr 2005 12:38:55 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi Trent, Thanks for the prompt response. Before diving deeper, I was wondering if there is a timeout parameter somewhere in the stack that I have not set properly. Given the nature of the failure (only fails if the line has been idle for a few seconds), it feels like some kind of timeout issue... Thanks again, Thom -----Original Message----- From: rxtx-bounces at mail.linuxgrrls.org [mailto:rxtx-bounces at mail.linuxgrrls.org] On Behalf Of Trent Jarvi Sent: Thursday, April 07, 2005 6:23 PM To: Java RXTX discussion Subject: Re: [Rxtx] Input/output error in writeArray On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a > Windows box. Everything connects up fine, and I can send and receive > a simple sequence of bytes with no problems. However, if around 5 > seconds goes by without me sending something, I get the following when > I attempt to send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at mail.linuxgrrls.org http://mail.linuxgrrls.org/mailman/listinfo/rxtx From ricardo.trindade at emation.pt Mon Apr 4 09:17:23 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Mon, 04 Apr 2005 16:17:23 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot Message-ID: <42515A83.4050907@emation.pt> Hi, I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most recent stable snapshot), and get the following exception : It looks like rxtx has been compiled with jdk 1.5. If this was indeed the case, I think there is a compilation flag that generates code that runs on older jdks. java.lang.UnsupportedClassVersionError: gnu/io/UnsupportedCommOperationException (Unsupported major.minor version 49.0) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at java.net.URLClassLoader.defineClass(URLClassLoader.java:251) at java.net.URLClassLoader.access$100(URLClassLoader.java:55) at java.net.URLClassLoader$1.run(URLClassLoader.java:194) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:187) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:141) I'm trying to run it with 1.4. thanks Ricardo From taj at www.linux.org.uk Tue Apr 5 00:48:12 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 07:48:12 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42515A83.4050907@emation.pt> References: <42515A83.4050907@emation.pt> Message-ID: On Mon, 4 Apr 2005, Ricardo Trindade wrote: > Hi, > > I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most > recent stable snapshot), and get the following exception : > > It looks like rxtx has been compiled with jdk 1.5. If this was > indeed the case, I think there is a compilation flag that generates code > that runs on older jdks. > > java.lang.UnsupportedClassVersionError: > gnu/io/UnsupportedCommOperationException (Unsupported major.minor > version 49.0) [snip] Thanks Ricardo I recompiled the jar with javac -source 1.3 -target 1.3. That should cover most of the JRE's in use today. I also compiled the rxtx 2.0 x86_64 native library which appeared to be missing. I tried looking for flags to pass gcc 4.0 to make the native libraries more backwards compatible but only found options for C++ which is not used in rxtx. I've got a list of other bugs that I'll be going through in the next few weeks but for now I just left them with the same CVS filename - no code changes. ftp://ftp.qbang.org/pub/rxtx/rxtx-2.0-CVS-20050120-bins.tar.gz ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-CVS-20050120-bins.tar.gz -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Tue Apr 5 02:24:33 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 05 Apr 2005 09:24:33 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: References: <42515A83.4050907@emation.pt> Message-ID: <42524B41.3040300@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050405/5919abbb/attachment-0134.html From taj at www.linux.org.uk Tue Apr 5 03:00:29 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 10:00:29 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42524B41.3040300@emation.pt> References: <42515A83.4050907@emation.pt> <42524B41.3040300@emation.pt> Message-ID: On Tue, 5 Apr 2005, Ricardo Trindade wrote: > Will you anounce to the list when a new release is available ? > There will be several incremental releases announced here. Once those are done, we will release 2.1.7 and 2.0.7. -- Trent Jarvi taj at www.linux.org.uk From no_spam at somewhere.com Tue Apr 5 11:55:37 2005 From: no_spam at somewhere.com (no_spam@somewhere.com) Date: Tue, 5 Apr 2005 13:55:37 -0400 Subject: [Rxtx] Closing a port from an event listener results in a deadlock Message-ID: <20050405175537.GA21747@rcog.homelinux.net> On the message I sent on March 14, does anyone had the chance to try the modification? Or was it already fixed? (I haven't searched the archive extensively) Or maybe my message got catched by some spam filters? (it made it to the list archive though) Anyway, I would appreciate some feedback (through the list) Thanks From taj at www.linux.org.uk Tue Apr 5 14:42:28 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 21:42:28 +0100 (BST) Subject: [Rxtx] Closing a port from an event listener results in a deadlock In-Reply-To: <20050405175537.GA21747@rcog.homelinux.net> References: <20050405175537.GA21747@rcog.homelinux.net> Message-ID: On Tue, 5 Apr 2005 no_spam at somewhere.com wrote: > On the message I sent on March 14, does anyone had the chance to try the > modification? > > Or was it already fixed? (I haven't searched the archive extensively) > > Or maybe my message got catched by some spam filters? (it made it to the list > archive though) > > Anyway, I would appreciate some feedback (through the list) > The patch is here http://marc.theaimsgroup.com/?l=rxtx&m=111084488820288&w=2 I have applied this patch to a local copy but will not be doing formal testing for a couple weeks. I do not try to close ports from inside the eventListenter usually so I encourage any feedback also. If there are no problems reported, I expect this will go into rxtx 2.1-7. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Wed Apr 6 08:33:42 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Wed, 06 Apr 2005 15:33:42 +0100 Subject: [Rxtx] getting RXTX version Message-ID: <4253F346.50102@emation.pt> Hi, I want to make sure my deployments have the same version of RXTX jar and native lib. I know the version of the jar can be obtained in the Version class, but how can I obtain the native version ? I know RXTX prints to the console a warning if the version is different. Is there a way to programatically know is this is the case ? I would like to log that to our app's log thanks Ricardo From taj at www.linux.org.uk Wed Apr 6 15:10:20 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 6 Apr 2005 22:10:20 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4253F346.50102@emation.pt> References: <4253F346.50102@emation.pt> Message-ID: On Wed, 6 Apr 2005, Ricardo Trindade wrote: > Hi, > > I want to make sure my deployments have the same version of RXTX jar > and native lib. > > I know the version of the jar can be obtained in the Version class, > but how can I obtain the native version ? > > I know RXTX prints to the console a warning if the version is > different. Is there a way to programatically know is this is the case ? > > I would like to log that to our app's log > There isn't a suggested way of doing that right now. We could move things around and have a static String RXTXVersion.getNativeVersion() in future releases. Is this what you expected? This is not documented in commapi at all. I just tossed that in to catch conflicts while developing. It would be nice to have access in GUI applications though. It may be possible to access RXTXCommDriver.LibVersion right now. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Thu Apr 7 02:51:00 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 09:51:00 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> Message-ID: <4254F474.7020905@emation.pt> >There isn't a suggested way of doing that right now. We could move things >around and have a static String RXTXVersion.getNativeVersion() in future >releases. Is this what you expected? > > Yes, that would be perfect. >This is not documented in commapi at all. I just tossed that in to catch >conflicts while developing. It would be nice to have access in GUI >applications though. > >It may be possible to access RXTXCommDriver.LibVersion right now. > > > I tried, and I don't think it's possible. From taj at www.linux.org.uk Thu Apr 7 03:32:04 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 7 Apr 2005 10:32:04 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4254F474.7020905@emation.pt> References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: On Thu, 7 Apr 2005, Ricardo Trindade wrote: > > >There isn't a suggested way of doing that right now. We could move things > >around and have a static String RXTXVersion.getNativeVersion() in future > >releases. Is this what you expected? > > > > > > Yes, that would be perfect. > The attached should do what you want. You will still need to catch an exception for older versions... -- Trent Jarvi taj at www.linux.org.uk -------------- next part -------------- ? public_version.patch Index: RXTXCommDriver.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXCommDriver.java,v retrieving revision 1.16.2.51 diff -u -r1.16.2.51 RXTXCommDriver.java --- RXTXCommDriver.java 12 Oct 2004 09:13:30 -0000 1.16.2.51 +++ RXTXCommDriver.java 7 Apr 2005 09:29:04 -0000 @@ -54,7 +54,7 @@ the Library. */ String JarVersion = RXTXVersion.getVersion(); - String LibVersion = nativeGetVersion(); + String LibVersion = RXTXVersion.nativeGetVersion(); if ( devel ) { System.out.println("Devel Library"); @@ -76,7 +76,6 @@ /** Get the Serial port prefixes for the running OS */ private String deviceDirectory; private String osName; - private static native String nativeGetVersion(); private native boolean registerKnownPorts(int PortType); private native boolean isPortPrefixValid(String dev); private native boolean testRead(String dev, int type); Index: RXTXVersion.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXVersion.java,v retrieving revision 1.2.2.31 diff -u -r1.2.2.31 RXTXVersion.java --- RXTXVersion.java 16 Oct 2004 16:20:35 -0000 1.2.2.31 +++ RXTXVersion.java 7 Apr 2005 09:29:04 -0000 @@ -36,6 +36,7 @@ private static String Version; static { + System.loadLibrary( "rxtxSerial" ); Version = "RXTX-2.1-7pre20"; } /** @@ -47,4 +48,5 @@ { return(Version); } + public static native String nativeGetVersion(); } Index: SerialImp.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v retrieving revision 1.46.2.181 diff -u -r1.46.2.181 SerialImp.c --- SerialImp.c 17 Oct 2004 09:48:56 -0000 1.46.2.181 +++ SerialImp.c 7 Apr 2005 09:29:07 -0000 @@ -116,6 +116,7 @@ * It will eventually be removed. * */ #define RXTXPort(foo) Java_gnu_io_RXTXPort_ ## foo +#define RXTXVersion(foo) Java_gnu_io_RXTXVersion_ ## foo #define RXTXCommDriver(foo) Java_gnu_io_RXTXCommDriver_ ## foo #if defined(__sun__) || defined(__hpux__) @@ -4001,7 +4002,7 @@ } /*---------------------------------------------------------- -RXTXCommDriver.nativeGetVersion +RXTXVersion.nativeGetVersion accept: none perform: return the current version @@ -4010,9 +4011,10 @@ comments: This is used to avoid mixing versions of the .jar and native library. First introduced in rxtx-1.5-9 + Moved from RXTXCommDriver to RXTXVersion in rxtx-2.1-7 ----------------------------------------------------------*/ -JNIEXPORT jstring JNICALL RXTXCommDriver(nativeGetVersion) (JNIEnv *env, +JNIEXPORT jstring JNICALL RXTXVersion(nativeGetVersion) (JNIEnv *env, jclass jclazz ) { return (*env)->NewStringUTF( env, "RXTX-2.1-7pre20" ); From ricardo.trindade at emation.pt Thu Apr 7 03:45:58 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 10:45:58 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: <42550156.2040908@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050407/05212451/attachment-0134.html From thomas.shulok at lmco.com Thu Apr 7 17:43:11 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Thu, 07 Apr 2005 19:43:11 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi There, I'm attempting to talk RS232 between an embedded Linux box and a Windows box. Everything connects up fine, and I can send and receive a simple sequence of bytes with no problems. However, if around 5 seconds goes by without me sending something, I get the following when I attempt to send. java.io.IOException: Input/output error in writeArray Stack trace: java/lang/Throwable.()V java/lang/Throwable.(Ljava/lang/String;)V java/io/IOException.(Ljava/lang/String;)V gnu/io/RXTXPort.writeArray([BIIZ)V gnu/io/RXTXPort$SerialOutputStream.write([B)V SerialTest.main([Ljava/lang/String;)V If there interval is shorter (say 2 seconds between sends), I have no problems. On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and librxtxSerial-2.0.7pre2.so. Any ideas? Thanks, Thom -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5b23dcf/attachment-0134.html From taj at www.linux.org.uk Thu Apr 7 19:22:36 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:22:36 +0100 (BST) Subject: [Rxtx] Input/output error in writeArray In-Reply-To: References: Message-ID: On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a Windows > box. Everything connects up fine, and I can send and receive a simple > sequence of bytes with no problems. However, if around 5 seconds goes > by without me sending something, I get the following when I attempt to > send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Apr 7 19:24:59 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:24:59 +0100 (BST) Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) Message-ID: hmm. This would not work from applets would it? -- Trent Jarvi taj at www.linux.org.uk ---------- Forwarded message ---------- Date: Thu, 07 Apr 2005 16:05:53 -0400 From: Chris Gaffney To: taj at www.linux.org.uk Subject: RXTX Libraries on Classpath fix Hi, I submitted a patch for RXTX a few weeks ago to allow for loading the native libraries from the classpath. Since sending it to you I found it wasn't working on windows. I've fixed the problem and created a new patch that should replace the older one. The actual change is a one line from a String.equals() to a String.startsWith(). Thanks for a great piece of software, -Chris Gaffney Grand Valley State University -------------- next part -------------- A non-text attachment was scrubbed... Name: libraries_on_classpath_fixed.patch Type: text/x-patch Size: 5617 bytes Desc: Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5d423b8/libraries_on_classpath_fixed-0134.bin From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From thomas.shulok at lmco.com Fri Apr 8 10:38:55 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Fri, 08 Apr 2005 12:38:55 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi Trent, Thanks for the prompt response. Before diving deeper, I was wondering if there is a timeout parameter somewhere in the stack that I have not set properly. Given the nature of the failure (only fails if the line has been idle for a few seconds), it feels like some kind of timeout issue... Thanks again, Thom -----Original Message----- From: rxtx-bounces at mail.linuxgrrls.org [mailto:rxtx-bounces at mail.linuxgrrls.org] On Behalf Of Trent Jarvi Sent: Thursday, April 07, 2005 6:23 PM To: Java RXTX discussion Subject: Re: [Rxtx] Input/output error in writeArray On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a > Windows box. Everything connects up fine, and I can send and receive > a simple sequence of bytes with no problems. However, if around 5 > seconds goes by without me sending something, I get the following when > I attempt to send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at mail.linuxgrrls.org http://mail.linuxgrrls.org/mailman/listinfo/rxtx From ricardo.trindade at emation.pt Mon Apr 4 09:17:23 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Mon, 04 Apr 2005 16:17:23 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot Message-ID: <42515A83.4050907@emation.pt> Hi, I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most recent stable snapshot), and get the following exception : It looks like rxtx has been compiled with jdk 1.5. If this was indeed the case, I think there is a compilation flag that generates code that runs on older jdks. java.lang.UnsupportedClassVersionError: gnu/io/UnsupportedCommOperationException (Unsupported major.minor version 49.0) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at java.net.URLClassLoader.defineClass(URLClassLoader.java:251) at java.net.URLClassLoader.access$100(URLClassLoader.java:55) at java.net.URLClassLoader$1.run(URLClassLoader.java:194) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:187) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:141) I'm trying to run it with 1.4. thanks Ricardo From taj at www.linux.org.uk Tue Apr 5 00:48:12 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 07:48:12 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42515A83.4050907@emation.pt> References: <42515A83.4050907@emation.pt> Message-ID: On Mon, 4 Apr 2005, Ricardo Trindade wrote: > Hi, > > I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most > recent stable snapshot), and get the following exception : > > It looks like rxtx has been compiled with jdk 1.5. If this was > indeed the case, I think there is a compilation flag that generates code > that runs on older jdks. > > java.lang.UnsupportedClassVersionError: > gnu/io/UnsupportedCommOperationException (Unsupported major.minor > version 49.0) [snip] Thanks Ricardo I recompiled the jar with javac -source 1.3 -target 1.3. That should cover most of the JRE's in use today. I also compiled the rxtx 2.0 x86_64 native library which appeared to be missing. I tried looking for flags to pass gcc 4.0 to make the native libraries more backwards compatible but only found options for C++ which is not used in rxtx. I've got a list of other bugs that I'll be going through in the next few weeks but for now I just left them with the same CVS filename - no code changes. ftp://ftp.qbang.org/pub/rxtx/rxtx-2.0-CVS-20050120-bins.tar.gz ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-CVS-20050120-bins.tar.gz -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Tue Apr 5 02:24:33 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 05 Apr 2005 09:24:33 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: References: <42515A83.4050907@emation.pt> Message-ID: <42524B41.3040300@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050405/5919abbb/attachment-0135.html From taj at www.linux.org.uk Tue Apr 5 03:00:29 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 10:00:29 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42524B41.3040300@emation.pt> References: <42515A83.4050907@emation.pt> <42524B41.3040300@emation.pt> Message-ID: On Tue, 5 Apr 2005, Ricardo Trindade wrote: > Will you anounce to the list when a new release is available ? > There will be several incremental releases announced here. Once those are done, we will release 2.1.7 and 2.0.7. -- Trent Jarvi taj at www.linux.org.uk From no_spam at somewhere.com Tue Apr 5 11:55:37 2005 From: no_spam at somewhere.com (no_spam@somewhere.com) Date: Tue, 5 Apr 2005 13:55:37 -0400 Subject: [Rxtx] Closing a port from an event listener results in a deadlock Message-ID: <20050405175537.GA21747@rcog.homelinux.net> On the message I sent on March 14, does anyone had the chance to try the modification? Or was it already fixed? (I haven't searched the archive extensively) Or maybe my message got catched by some spam filters? (it made it to the list archive though) Anyway, I would appreciate some feedback (through the list) Thanks From taj at www.linux.org.uk Tue Apr 5 14:42:28 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 21:42:28 +0100 (BST) Subject: [Rxtx] Closing a port from an event listener results in a deadlock In-Reply-To: <20050405175537.GA21747@rcog.homelinux.net> References: <20050405175537.GA21747@rcog.homelinux.net> Message-ID: On Tue, 5 Apr 2005 no_spam at somewhere.com wrote: > On the message I sent on March 14, does anyone had the chance to try the > modification? > > Or was it already fixed? (I haven't searched the archive extensively) > > Or maybe my message got catched by some spam filters? (it made it to the list > archive though) > > Anyway, I would appreciate some feedback (through the list) > The patch is here http://marc.theaimsgroup.com/?l=rxtx&m=111084488820288&w=2 I have applied this patch to a local copy but will not be doing formal testing for a couple weeks. I do not try to close ports from inside the eventListenter usually so I encourage any feedback also. If there are no problems reported, I expect this will go into rxtx 2.1-7. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Wed Apr 6 08:33:42 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Wed, 06 Apr 2005 15:33:42 +0100 Subject: [Rxtx] getting RXTX version Message-ID: <4253F346.50102@emation.pt> Hi, I want to make sure my deployments have the same version of RXTX jar and native lib. I know the version of the jar can be obtained in the Version class, but how can I obtain the native version ? I know RXTX prints to the console a warning if the version is different. Is there a way to programatically know is this is the case ? I would like to log that to our app's log thanks Ricardo From taj at www.linux.org.uk Wed Apr 6 15:10:20 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 6 Apr 2005 22:10:20 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4253F346.50102@emation.pt> References: <4253F346.50102@emation.pt> Message-ID: On Wed, 6 Apr 2005, Ricardo Trindade wrote: > Hi, > > I want to make sure my deployments have the same version of RXTX jar > and native lib. > > I know the version of the jar can be obtained in the Version class, > but how can I obtain the native version ? > > I know RXTX prints to the console a warning if the version is > different. Is there a way to programatically know is this is the case ? > > I would like to log that to our app's log > There isn't a suggested way of doing that right now. We could move things around and have a static String RXTXVersion.getNativeVersion() in future releases. Is this what you expected? This is not documented in commapi at all. I just tossed that in to catch conflicts while developing. It would be nice to have access in GUI applications though. It may be possible to access RXTXCommDriver.LibVersion right now. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Thu Apr 7 02:51:00 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 09:51:00 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> Message-ID: <4254F474.7020905@emation.pt> >There isn't a suggested way of doing that right now. We could move things >around and have a static String RXTXVersion.getNativeVersion() in future >releases. Is this what you expected? > > Yes, that would be perfect. >This is not documented in commapi at all. I just tossed that in to catch >conflicts while developing. It would be nice to have access in GUI >applications though. > >It may be possible to access RXTXCommDriver.LibVersion right now. > > > I tried, and I don't think it's possible. From taj at www.linux.org.uk Thu Apr 7 03:32:04 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 7 Apr 2005 10:32:04 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4254F474.7020905@emation.pt> References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: On Thu, 7 Apr 2005, Ricardo Trindade wrote: > > >There isn't a suggested way of doing that right now. We could move things > >around and have a static String RXTXVersion.getNativeVersion() in future > >releases. Is this what you expected? > > > > > > Yes, that would be perfect. > The attached should do what you want. You will still need to catch an exception for older versions... -- Trent Jarvi taj at www.linux.org.uk -------------- next part -------------- ? public_version.patch Index: RXTXCommDriver.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXCommDriver.java,v retrieving revision 1.16.2.51 diff -u -r1.16.2.51 RXTXCommDriver.java --- RXTXCommDriver.java 12 Oct 2004 09:13:30 -0000 1.16.2.51 +++ RXTXCommDriver.java 7 Apr 2005 09:29:04 -0000 @@ -54,7 +54,7 @@ the Library. */ String JarVersion = RXTXVersion.getVersion(); - String LibVersion = nativeGetVersion(); + String LibVersion = RXTXVersion.nativeGetVersion(); if ( devel ) { System.out.println("Devel Library"); @@ -76,7 +76,6 @@ /** Get the Serial port prefixes for the running OS */ private String deviceDirectory; private String osName; - private static native String nativeGetVersion(); private native boolean registerKnownPorts(int PortType); private native boolean isPortPrefixValid(String dev); private native boolean testRead(String dev, int type); Index: RXTXVersion.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXVersion.java,v retrieving revision 1.2.2.31 diff -u -r1.2.2.31 RXTXVersion.java --- RXTXVersion.java 16 Oct 2004 16:20:35 -0000 1.2.2.31 +++ RXTXVersion.java 7 Apr 2005 09:29:04 -0000 @@ -36,6 +36,7 @@ private static String Version; static { + System.loadLibrary( "rxtxSerial" ); Version = "RXTX-2.1-7pre20"; } /** @@ -47,4 +48,5 @@ { return(Version); } + public static native String nativeGetVersion(); } Index: SerialImp.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v retrieving revision 1.46.2.181 diff -u -r1.46.2.181 SerialImp.c --- SerialImp.c 17 Oct 2004 09:48:56 -0000 1.46.2.181 +++ SerialImp.c 7 Apr 2005 09:29:07 -0000 @@ -116,6 +116,7 @@ * It will eventually be removed. * */ #define RXTXPort(foo) Java_gnu_io_RXTXPort_ ## foo +#define RXTXVersion(foo) Java_gnu_io_RXTXVersion_ ## foo #define RXTXCommDriver(foo) Java_gnu_io_RXTXCommDriver_ ## foo #if defined(__sun__) || defined(__hpux__) @@ -4001,7 +4002,7 @@ } /*---------------------------------------------------------- -RXTXCommDriver.nativeGetVersion +RXTXVersion.nativeGetVersion accept: none perform: return the current version @@ -4010,9 +4011,10 @@ comments: This is used to avoid mixing versions of the .jar and native library. First introduced in rxtx-1.5-9 + Moved from RXTXCommDriver to RXTXVersion in rxtx-2.1-7 ----------------------------------------------------------*/ -JNIEXPORT jstring JNICALL RXTXCommDriver(nativeGetVersion) (JNIEnv *env, +JNIEXPORT jstring JNICALL RXTXVersion(nativeGetVersion) (JNIEnv *env, jclass jclazz ) { return (*env)->NewStringUTF( env, "RXTX-2.1-7pre20" ); From ricardo.trindade at emation.pt Thu Apr 7 03:45:58 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 10:45:58 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: <42550156.2040908@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050407/05212451/attachment-0135.html From thomas.shulok at lmco.com Thu Apr 7 17:43:11 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Thu, 07 Apr 2005 19:43:11 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi There, I'm attempting to talk RS232 between an embedded Linux box and a Windows box. Everything connects up fine, and I can send and receive a simple sequence of bytes with no problems. However, if around 5 seconds goes by without me sending something, I get the following when I attempt to send. java.io.IOException: Input/output error in writeArray Stack trace: java/lang/Throwable.()V java/lang/Throwable.(Ljava/lang/String;)V java/io/IOException.(Ljava/lang/String;)V gnu/io/RXTXPort.writeArray([BIIZ)V gnu/io/RXTXPort$SerialOutputStream.write([B)V SerialTest.main([Ljava/lang/String;)V If there interval is shorter (say 2 seconds between sends), I have no problems. On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and librxtxSerial-2.0.7pre2.so. Any ideas? Thanks, Thom -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5b23dcf/attachment-0135.html From taj at www.linux.org.uk Thu Apr 7 19:22:36 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:22:36 +0100 (BST) Subject: [Rxtx] Input/output error in writeArray In-Reply-To: References: Message-ID: On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a Windows > box. Everything connects up fine, and I can send and receive a simple > sequence of bytes with no problems. However, if around 5 seconds goes > by without me sending something, I get the following when I attempt to > send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Apr 7 19:24:59 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:24:59 +0100 (BST) Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) Message-ID: hmm. This would not work from applets would it? -- Trent Jarvi taj at www.linux.org.uk ---------- Forwarded message ---------- Date: Thu, 07 Apr 2005 16:05:53 -0400 From: Chris Gaffney To: taj at www.linux.org.uk Subject: RXTX Libraries on Classpath fix Hi, I submitted a patch for RXTX a few weeks ago to allow for loading the native libraries from the classpath. Since sending it to you I found it wasn't working on windows. I've fixed the problem and created a new patch that should replace the older one. The actual change is a one line from a String.equals() to a String.startsWith(). Thanks for a great piece of software, -Chris Gaffney Grand Valley State University -------------- next part -------------- A non-text attachment was scrubbed... Name: libraries_on_classpath_fixed.patch Type: text/x-patch Size: 5617 bytes Desc: Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5d423b8/libraries_on_classpath_fixed-0135.bin From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From thomas.shulok at lmco.com Fri Apr 8 10:38:55 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Fri, 08 Apr 2005 12:38:55 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi Trent, Thanks for the prompt response. Before diving deeper, I was wondering if there is a timeout parameter somewhere in the stack that I have not set properly. Given the nature of the failure (only fails if the line has been idle for a few seconds), it feels like some kind of timeout issue... Thanks again, Thom -----Original Message----- From: rxtx-bounces at mail.linuxgrrls.org [mailto:rxtx-bounces at mail.linuxgrrls.org] On Behalf Of Trent Jarvi Sent: Thursday, April 07, 2005 6:23 PM To: Java RXTX discussion Subject: Re: [Rxtx] Input/output error in writeArray On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a > Windows box. Everything connects up fine, and I can send and receive > a simple sequence of bytes with no problems. However, if around 5 > seconds goes by without me sending something, I get the following when > I attempt to send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at mail.linuxgrrls.org http://mail.linuxgrrls.org/mailman/listinfo/rxtx From ricardo.trindade at emation.pt Mon Apr 4 09:17:23 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Mon, 04 Apr 2005 16:17:23 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot Message-ID: <42515A83.4050907@emation.pt> Hi, I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most recent stable snapshot), and get the following exception : It looks like rxtx has been compiled with jdk 1.5. If this was indeed the case, I think there is a compilation flag that generates code that runs on older jdks. java.lang.UnsupportedClassVersionError: gnu/io/UnsupportedCommOperationException (Unsupported major.minor version 49.0) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at java.net.URLClassLoader.defineClass(URLClassLoader.java:251) at java.net.URLClassLoader.access$100(URLClassLoader.java:55) at java.net.URLClassLoader$1.run(URLClassLoader.java:194) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:187) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:141) I'm trying to run it with 1.4. thanks Ricardo From taj at www.linux.org.uk Tue Apr 5 00:48:12 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 07:48:12 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42515A83.4050907@emation.pt> References: <42515A83.4050907@emation.pt> Message-ID: On Mon, 4 Apr 2005, Ricardo Trindade wrote: > Hi, > > I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most > recent stable snapshot), and get the following exception : > > It looks like rxtx has been compiled with jdk 1.5. If this was > indeed the case, I think there is a compilation flag that generates code > that runs on older jdks. > > java.lang.UnsupportedClassVersionError: > gnu/io/UnsupportedCommOperationException (Unsupported major.minor > version 49.0) [snip] Thanks Ricardo I recompiled the jar with javac -source 1.3 -target 1.3. That should cover most of the JRE's in use today. I also compiled the rxtx 2.0 x86_64 native library which appeared to be missing. I tried looking for flags to pass gcc 4.0 to make the native libraries more backwards compatible but only found options for C++ which is not used in rxtx. I've got a list of other bugs that I'll be going through in the next few weeks but for now I just left them with the same CVS filename - no code changes. ftp://ftp.qbang.org/pub/rxtx/rxtx-2.0-CVS-20050120-bins.tar.gz ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-CVS-20050120-bins.tar.gz -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Tue Apr 5 02:24:33 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 05 Apr 2005 09:24:33 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: References: <42515A83.4050907@emation.pt> Message-ID: <42524B41.3040300@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050405/5919abbb/attachment-0136.html From taj at www.linux.org.uk Tue Apr 5 03:00:29 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 10:00:29 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42524B41.3040300@emation.pt> References: <42515A83.4050907@emation.pt> <42524B41.3040300@emation.pt> Message-ID: On Tue, 5 Apr 2005, Ricardo Trindade wrote: > Will you anounce to the list when a new release is available ? > There will be several incremental releases announced here. Once those are done, we will release 2.1.7 and 2.0.7. -- Trent Jarvi taj at www.linux.org.uk From no_spam at somewhere.com Tue Apr 5 11:55:37 2005 From: no_spam at somewhere.com (no_spam@somewhere.com) Date: Tue, 5 Apr 2005 13:55:37 -0400 Subject: [Rxtx] Closing a port from an event listener results in a deadlock Message-ID: <20050405175537.GA21747@rcog.homelinux.net> On the message I sent on March 14, does anyone had the chance to try the modification? Or was it already fixed? (I haven't searched the archive extensively) Or maybe my message got catched by some spam filters? (it made it to the list archive though) Anyway, I would appreciate some feedback (through the list) Thanks From taj at www.linux.org.uk Tue Apr 5 14:42:28 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 21:42:28 +0100 (BST) Subject: [Rxtx] Closing a port from an event listener results in a deadlock In-Reply-To: <20050405175537.GA21747@rcog.homelinux.net> References: <20050405175537.GA21747@rcog.homelinux.net> Message-ID: On Tue, 5 Apr 2005 no_spam at somewhere.com wrote: > On the message I sent on March 14, does anyone had the chance to try the > modification? > > Or was it already fixed? (I haven't searched the archive extensively) > > Or maybe my message got catched by some spam filters? (it made it to the list > archive though) > > Anyway, I would appreciate some feedback (through the list) > The patch is here http://marc.theaimsgroup.com/?l=rxtx&m=111084488820288&w=2 I have applied this patch to a local copy but will not be doing formal testing for a couple weeks. I do not try to close ports from inside the eventListenter usually so I encourage any feedback also. If there are no problems reported, I expect this will go into rxtx 2.1-7. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Wed Apr 6 08:33:42 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Wed, 06 Apr 2005 15:33:42 +0100 Subject: [Rxtx] getting RXTX version Message-ID: <4253F346.50102@emation.pt> Hi, I want to make sure my deployments have the same version of RXTX jar and native lib. I know the version of the jar can be obtained in the Version class, but how can I obtain the native version ? I know RXTX prints to the console a warning if the version is different. Is there a way to programatically know is this is the case ? I would like to log that to our app's log thanks Ricardo From taj at www.linux.org.uk Wed Apr 6 15:10:20 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 6 Apr 2005 22:10:20 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4253F346.50102@emation.pt> References: <4253F346.50102@emation.pt> Message-ID: On Wed, 6 Apr 2005, Ricardo Trindade wrote: > Hi, > > I want to make sure my deployments have the same version of RXTX jar > and native lib. > > I know the version of the jar can be obtained in the Version class, > but how can I obtain the native version ? > > I know RXTX prints to the console a warning if the version is > different. Is there a way to programatically know is this is the case ? > > I would like to log that to our app's log > There isn't a suggested way of doing that right now. We could move things around and have a static String RXTXVersion.getNativeVersion() in future releases. Is this what you expected? This is not documented in commapi at all. I just tossed that in to catch conflicts while developing. It would be nice to have access in GUI applications though. It may be possible to access RXTXCommDriver.LibVersion right now. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Thu Apr 7 02:51:00 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 09:51:00 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> Message-ID: <4254F474.7020905@emation.pt> >There isn't a suggested way of doing that right now. We could move things >around and have a static String RXTXVersion.getNativeVersion() in future >releases. Is this what you expected? > > Yes, that would be perfect. >This is not documented in commapi at all. I just tossed that in to catch >conflicts while developing. It would be nice to have access in GUI >applications though. > >It may be possible to access RXTXCommDriver.LibVersion right now. > > > I tried, and I don't think it's possible. From taj at www.linux.org.uk Thu Apr 7 03:32:04 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 7 Apr 2005 10:32:04 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4254F474.7020905@emation.pt> References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: On Thu, 7 Apr 2005, Ricardo Trindade wrote: > > >There isn't a suggested way of doing that right now. We could move things > >around and have a static String RXTXVersion.getNativeVersion() in future > >releases. Is this what you expected? > > > > > > Yes, that would be perfect. > The attached should do what you want. You will still need to catch an exception for older versions... -- Trent Jarvi taj at www.linux.org.uk -------------- next part -------------- ? public_version.patch Index: RXTXCommDriver.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXCommDriver.java,v retrieving revision 1.16.2.51 diff -u -r1.16.2.51 RXTXCommDriver.java --- RXTXCommDriver.java 12 Oct 2004 09:13:30 -0000 1.16.2.51 +++ RXTXCommDriver.java 7 Apr 2005 09:29:04 -0000 @@ -54,7 +54,7 @@ the Library. */ String JarVersion = RXTXVersion.getVersion(); - String LibVersion = nativeGetVersion(); + String LibVersion = RXTXVersion.nativeGetVersion(); if ( devel ) { System.out.println("Devel Library"); @@ -76,7 +76,6 @@ /** Get the Serial port prefixes for the running OS */ private String deviceDirectory; private String osName; - private static native String nativeGetVersion(); private native boolean registerKnownPorts(int PortType); private native boolean isPortPrefixValid(String dev); private native boolean testRead(String dev, int type); Index: RXTXVersion.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXVersion.java,v retrieving revision 1.2.2.31 diff -u -r1.2.2.31 RXTXVersion.java --- RXTXVersion.java 16 Oct 2004 16:20:35 -0000 1.2.2.31 +++ RXTXVersion.java 7 Apr 2005 09:29:04 -0000 @@ -36,6 +36,7 @@ private static String Version; static { + System.loadLibrary( "rxtxSerial" ); Version = "RXTX-2.1-7pre20"; } /** @@ -47,4 +48,5 @@ { return(Version); } + public static native String nativeGetVersion(); } Index: SerialImp.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v retrieving revision 1.46.2.181 diff -u -r1.46.2.181 SerialImp.c --- SerialImp.c 17 Oct 2004 09:48:56 -0000 1.46.2.181 +++ SerialImp.c 7 Apr 2005 09:29:07 -0000 @@ -116,6 +116,7 @@ * It will eventually be removed. * */ #define RXTXPort(foo) Java_gnu_io_RXTXPort_ ## foo +#define RXTXVersion(foo) Java_gnu_io_RXTXVersion_ ## foo #define RXTXCommDriver(foo) Java_gnu_io_RXTXCommDriver_ ## foo #if defined(__sun__) || defined(__hpux__) @@ -4001,7 +4002,7 @@ } /*---------------------------------------------------------- -RXTXCommDriver.nativeGetVersion +RXTXVersion.nativeGetVersion accept: none perform: return the current version @@ -4010,9 +4011,10 @@ comments: This is used to avoid mixing versions of the .jar and native library. First introduced in rxtx-1.5-9 + Moved from RXTXCommDriver to RXTXVersion in rxtx-2.1-7 ----------------------------------------------------------*/ -JNIEXPORT jstring JNICALL RXTXCommDriver(nativeGetVersion) (JNIEnv *env, +JNIEXPORT jstring JNICALL RXTXVersion(nativeGetVersion) (JNIEnv *env, jclass jclazz ) { return (*env)->NewStringUTF( env, "RXTX-2.1-7pre20" ); From ricardo.trindade at emation.pt Thu Apr 7 03:45:58 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 10:45:58 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: <42550156.2040908@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050407/05212451/attachment-0136.html From thomas.shulok at lmco.com Thu Apr 7 17:43:11 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Thu, 07 Apr 2005 19:43:11 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi There, I'm attempting to talk RS232 between an embedded Linux box and a Windows box. Everything connects up fine, and I can send and receive a simple sequence of bytes with no problems. However, if around 5 seconds goes by without me sending something, I get the following when I attempt to send. java.io.IOException: Input/output error in writeArray Stack trace: java/lang/Throwable.()V java/lang/Throwable.(Ljava/lang/String;)V java/io/IOException.(Ljava/lang/String;)V gnu/io/RXTXPort.writeArray([BIIZ)V gnu/io/RXTXPort$SerialOutputStream.write([B)V SerialTest.main([Ljava/lang/String;)V If there interval is shorter (say 2 seconds between sends), I have no problems. On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and librxtxSerial-2.0.7pre2.so. Any ideas? Thanks, Thom -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5b23dcf/attachment-0136.html From taj at www.linux.org.uk Thu Apr 7 19:22:36 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:22:36 +0100 (BST) Subject: [Rxtx] Input/output error in writeArray In-Reply-To: References: Message-ID: On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a Windows > box. Everything connects up fine, and I can send and receive a simple > sequence of bytes with no problems. However, if around 5 seconds goes > by without me sending something, I get the following when I attempt to > send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Apr 7 19:24:59 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:24:59 +0100 (BST) Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) Message-ID: hmm. This would not work from applets would it? -- Trent Jarvi taj at www.linux.org.uk ---------- Forwarded message ---------- Date: Thu, 07 Apr 2005 16:05:53 -0400 From: Chris Gaffney To: taj at www.linux.org.uk Subject: RXTX Libraries on Classpath fix Hi, I submitted a patch for RXTX a few weeks ago to allow for loading the native libraries from the classpath. Since sending it to you I found it wasn't working on windows. I've fixed the problem and created a new patch that should replace the older one. The actual change is a one line from a String.equals() to a String.startsWith(). Thanks for a great piece of software, -Chris Gaffney Grand Valley State University -------------- next part -------------- A non-text attachment was scrubbed... Name: libraries_on_classpath_fixed.patch Type: text/x-patch Size: 5617 bytes Desc: Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5d423b8/libraries_on_classpath_fixed-0136.bin From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From thomas.shulok at lmco.com Fri Apr 8 10:38:55 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Fri, 08 Apr 2005 12:38:55 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi Trent, Thanks for the prompt response. Before diving deeper, I was wondering if there is a timeout parameter somewhere in the stack that I have not set properly. Given the nature of the failure (only fails if the line has been idle for a few seconds), it feels like some kind of timeout issue... Thanks again, Thom -----Original Message----- From: rxtx-bounces at mail.linuxgrrls.org [mailto:rxtx-bounces at mail.linuxgrrls.org] On Behalf Of Trent Jarvi Sent: Thursday, April 07, 2005 6:23 PM To: Java RXTX discussion Subject: Re: [Rxtx] Input/output error in writeArray On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a > Windows box. Everything connects up fine, and I can send and receive > a simple sequence of bytes with no problems. However, if around 5 > seconds goes by without me sending something, I get the following when > I attempt to send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at mail.linuxgrrls.org http://mail.linuxgrrls.org/mailman/listinfo/rxtx From ricardo.trindade at emation.pt Mon Apr 4 09:17:23 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Mon, 04 Apr 2005 16:17:23 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot Message-ID: <42515A83.4050907@emation.pt> Hi, I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most recent stable snapshot), and get the following exception : It looks like rxtx has been compiled with jdk 1.5. If this was indeed the case, I think there is a compilation flag that generates code that runs on older jdks. java.lang.UnsupportedClassVersionError: gnu/io/UnsupportedCommOperationException (Unsupported major.minor version 49.0) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at java.net.URLClassLoader.defineClass(URLClassLoader.java:251) at java.net.URLClassLoader.access$100(URLClassLoader.java:55) at java.net.URLClassLoader$1.run(URLClassLoader.java:194) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:187) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:141) I'm trying to run it with 1.4. thanks Ricardo From taj at www.linux.org.uk Tue Apr 5 00:48:12 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 07:48:12 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42515A83.4050907@emation.pt> References: <42515A83.4050907@emation.pt> Message-ID: On Mon, 4 Apr 2005, Ricardo Trindade wrote: > Hi, > > I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most > recent stable snapshot), and get the following exception : > > It looks like rxtx has been compiled with jdk 1.5. If this was > indeed the case, I think there is a compilation flag that generates code > that runs on older jdks. > > java.lang.UnsupportedClassVersionError: > gnu/io/UnsupportedCommOperationException (Unsupported major.minor > version 49.0) [snip] Thanks Ricardo I recompiled the jar with javac -source 1.3 -target 1.3. That should cover most of the JRE's in use today. I also compiled the rxtx 2.0 x86_64 native library which appeared to be missing. I tried looking for flags to pass gcc 4.0 to make the native libraries more backwards compatible but only found options for C++ which is not used in rxtx. I've got a list of other bugs that I'll be going through in the next few weeks but for now I just left them with the same CVS filename - no code changes. ftp://ftp.qbang.org/pub/rxtx/rxtx-2.0-CVS-20050120-bins.tar.gz ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-CVS-20050120-bins.tar.gz -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Tue Apr 5 02:24:33 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 05 Apr 2005 09:24:33 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: References: <42515A83.4050907@emation.pt> Message-ID: <42524B41.3040300@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050405/5919abbb/attachment-0137.html From taj at www.linux.org.uk Tue Apr 5 03:00:29 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 10:00:29 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42524B41.3040300@emation.pt> References: <42515A83.4050907@emation.pt> <42524B41.3040300@emation.pt> Message-ID: On Tue, 5 Apr 2005, Ricardo Trindade wrote: > Will you anounce to the list when a new release is available ? > There will be several incremental releases announced here. Once those are done, we will release 2.1.7 and 2.0.7. -- Trent Jarvi taj at www.linux.org.uk From no_spam at somewhere.com Tue Apr 5 11:55:37 2005 From: no_spam at somewhere.com (no_spam@somewhere.com) Date: Tue, 5 Apr 2005 13:55:37 -0400 Subject: [Rxtx] Closing a port from an event listener results in a deadlock Message-ID: <20050405175537.GA21747@rcog.homelinux.net> On the message I sent on March 14, does anyone had the chance to try the modification? Or was it already fixed? (I haven't searched the archive extensively) Or maybe my message got catched by some spam filters? (it made it to the list archive though) Anyway, I would appreciate some feedback (through the list) Thanks From taj at www.linux.org.uk Tue Apr 5 14:42:28 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 21:42:28 +0100 (BST) Subject: [Rxtx] Closing a port from an event listener results in a deadlock In-Reply-To: <20050405175537.GA21747@rcog.homelinux.net> References: <20050405175537.GA21747@rcog.homelinux.net> Message-ID: On Tue, 5 Apr 2005 no_spam at somewhere.com wrote: > On the message I sent on March 14, does anyone had the chance to try the > modification? > > Or was it already fixed? (I haven't searched the archive extensively) > > Or maybe my message got catched by some spam filters? (it made it to the list > archive though) > > Anyway, I would appreciate some feedback (through the list) > The patch is here http://marc.theaimsgroup.com/?l=rxtx&m=111084488820288&w=2 I have applied this patch to a local copy but will not be doing formal testing for a couple weeks. I do not try to close ports from inside the eventListenter usually so I encourage any feedback also. If there are no problems reported, I expect this will go into rxtx 2.1-7. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Wed Apr 6 08:33:42 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Wed, 06 Apr 2005 15:33:42 +0100 Subject: [Rxtx] getting RXTX version Message-ID: <4253F346.50102@emation.pt> Hi, I want to make sure my deployments have the same version of RXTX jar and native lib. I know the version of the jar can be obtained in the Version class, but how can I obtain the native version ? I know RXTX prints to the console a warning if the version is different. Is there a way to programatically know is this is the case ? I would like to log that to our app's log thanks Ricardo From taj at www.linux.org.uk Wed Apr 6 15:10:20 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 6 Apr 2005 22:10:20 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4253F346.50102@emation.pt> References: <4253F346.50102@emation.pt> Message-ID: On Wed, 6 Apr 2005, Ricardo Trindade wrote: > Hi, > > I want to make sure my deployments have the same version of RXTX jar > and native lib. > > I know the version of the jar can be obtained in the Version class, > but how can I obtain the native version ? > > I know RXTX prints to the console a warning if the version is > different. Is there a way to programatically know is this is the case ? > > I would like to log that to our app's log > There isn't a suggested way of doing that right now. We could move things around and have a static String RXTXVersion.getNativeVersion() in future releases. Is this what you expected? This is not documented in commapi at all. I just tossed that in to catch conflicts while developing. It would be nice to have access in GUI applications though. It may be possible to access RXTXCommDriver.LibVersion right now. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Thu Apr 7 02:51:00 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 09:51:00 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> Message-ID: <4254F474.7020905@emation.pt> >There isn't a suggested way of doing that right now. We could move things >around and have a static String RXTXVersion.getNativeVersion() in future >releases. Is this what you expected? > > Yes, that would be perfect. >This is not documented in commapi at all. I just tossed that in to catch >conflicts while developing. It would be nice to have access in GUI >applications though. > >It may be possible to access RXTXCommDriver.LibVersion right now. > > > I tried, and I don't think it's possible. From taj at www.linux.org.uk Thu Apr 7 03:32:04 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 7 Apr 2005 10:32:04 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4254F474.7020905@emation.pt> References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: On Thu, 7 Apr 2005, Ricardo Trindade wrote: > > >There isn't a suggested way of doing that right now. We could move things > >around and have a static String RXTXVersion.getNativeVersion() in future > >releases. Is this what you expected? > > > > > > Yes, that would be perfect. > The attached should do what you want. You will still need to catch an exception for older versions... -- Trent Jarvi taj at www.linux.org.uk -------------- next part -------------- ? public_version.patch Index: RXTXCommDriver.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXCommDriver.java,v retrieving revision 1.16.2.51 diff -u -r1.16.2.51 RXTXCommDriver.java --- RXTXCommDriver.java 12 Oct 2004 09:13:30 -0000 1.16.2.51 +++ RXTXCommDriver.java 7 Apr 2005 09:29:04 -0000 @@ -54,7 +54,7 @@ the Library. */ String JarVersion = RXTXVersion.getVersion(); - String LibVersion = nativeGetVersion(); + String LibVersion = RXTXVersion.nativeGetVersion(); if ( devel ) { System.out.println("Devel Library"); @@ -76,7 +76,6 @@ /** Get the Serial port prefixes for the running OS */ private String deviceDirectory; private String osName; - private static native String nativeGetVersion(); private native boolean registerKnownPorts(int PortType); private native boolean isPortPrefixValid(String dev); private native boolean testRead(String dev, int type); Index: RXTXVersion.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXVersion.java,v retrieving revision 1.2.2.31 diff -u -r1.2.2.31 RXTXVersion.java --- RXTXVersion.java 16 Oct 2004 16:20:35 -0000 1.2.2.31 +++ RXTXVersion.java 7 Apr 2005 09:29:04 -0000 @@ -36,6 +36,7 @@ private static String Version; static { + System.loadLibrary( "rxtxSerial" ); Version = "RXTX-2.1-7pre20"; } /** @@ -47,4 +48,5 @@ { return(Version); } + public static native String nativeGetVersion(); } Index: SerialImp.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v retrieving revision 1.46.2.181 diff -u -r1.46.2.181 SerialImp.c --- SerialImp.c 17 Oct 2004 09:48:56 -0000 1.46.2.181 +++ SerialImp.c 7 Apr 2005 09:29:07 -0000 @@ -116,6 +116,7 @@ * It will eventually be removed. * */ #define RXTXPort(foo) Java_gnu_io_RXTXPort_ ## foo +#define RXTXVersion(foo) Java_gnu_io_RXTXVersion_ ## foo #define RXTXCommDriver(foo) Java_gnu_io_RXTXCommDriver_ ## foo #if defined(__sun__) || defined(__hpux__) @@ -4001,7 +4002,7 @@ } /*---------------------------------------------------------- -RXTXCommDriver.nativeGetVersion +RXTXVersion.nativeGetVersion accept: none perform: return the current version @@ -4010,9 +4011,10 @@ comments: This is used to avoid mixing versions of the .jar and native library. First introduced in rxtx-1.5-9 + Moved from RXTXCommDriver to RXTXVersion in rxtx-2.1-7 ----------------------------------------------------------*/ -JNIEXPORT jstring JNICALL RXTXCommDriver(nativeGetVersion) (JNIEnv *env, +JNIEXPORT jstring JNICALL RXTXVersion(nativeGetVersion) (JNIEnv *env, jclass jclazz ) { return (*env)->NewStringUTF( env, "RXTX-2.1-7pre20" ); From ricardo.trindade at emation.pt Thu Apr 7 03:45:58 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 10:45:58 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: <42550156.2040908@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050407/05212451/attachment-0137.html From thomas.shulok at lmco.com Thu Apr 7 17:43:11 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Thu, 07 Apr 2005 19:43:11 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi There, I'm attempting to talk RS232 between an embedded Linux box and a Windows box. Everything connects up fine, and I can send and receive a simple sequence of bytes with no problems. However, if around 5 seconds goes by without me sending something, I get the following when I attempt to send. java.io.IOException: Input/output error in writeArray Stack trace: java/lang/Throwable.()V java/lang/Throwable.(Ljava/lang/String;)V java/io/IOException.(Ljava/lang/String;)V gnu/io/RXTXPort.writeArray([BIIZ)V gnu/io/RXTXPort$SerialOutputStream.write([B)V SerialTest.main([Ljava/lang/String;)V If there interval is shorter (say 2 seconds between sends), I have no problems. On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and librxtxSerial-2.0.7pre2.so. Any ideas? Thanks, Thom -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5b23dcf/attachment-0137.html From taj at www.linux.org.uk Thu Apr 7 19:22:36 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:22:36 +0100 (BST) Subject: [Rxtx] Input/output error in writeArray In-Reply-To: References: Message-ID: On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a Windows > box. Everything connects up fine, and I can send and receive a simple > sequence of bytes with no problems. However, if around 5 seconds goes > by without me sending something, I get the following when I attempt to > send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Apr 7 19:24:59 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:24:59 +0100 (BST) Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) Message-ID: hmm. This would not work from applets would it? -- Trent Jarvi taj at www.linux.org.uk ---------- Forwarded message ---------- Date: Thu, 07 Apr 2005 16:05:53 -0400 From: Chris Gaffney To: taj at www.linux.org.uk Subject: RXTX Libraries on Classpath fix Hi, I submitted a patch for RXTX a few weeks ago to allow for loading the native libraries from the classpath. Since sending it to you I found it wasn't working on windows. I've fixed the problem and created a new patch that should replace the older one. The actual change is a one line from a String.equals() to a String.startsWith(). Thanks for a great piece of software, -Chris Gaffney Grand Valley State University -------------- next part -------------- A non-text attachment was scrubbed... Name: libraries_on_classpath_fixed.patch Type: text/x-patch Size: 5617 bytes Desc: Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5d423b8/libraries_on_classpath_fixed-0137.bin From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From thomas.shulok at lmco.com Fri Apr 8 10:38:55 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Fri, 08 Apr 2005 12:38:55 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi Trent, Thanks for the prompt response. Before diving deeper, I was wondering if there is a timeout parameter somewhere in the stack that I have not set properly. Given the nature of the failure (only fails if the line has been idle for a few seconds), it feels like some kind of timeout issue... Thanks again, Thom -----Original Message----- From: rxtx-bounces at mail.linuxgrrls.org [mailto:rxtx-bounces at mail.linuxgrrls.org] On Behalf Of Trent Jarvi Sent: Thursday, April 07, 2005 6:23 PM To: Java RXTX discussion Subject: Re: [Rxtx] Input/output error in writeArray On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a > Windows box. Everything connects up fine, and I can send and receive > a simple sequence of bytes with no problems. However, if around 5 > seconds goes by without me sending something, I get the following when > I attempt to send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at mail.linuxgrrls.org http://mail.linuxgrrls.org/mailman/listinfo/rxtx From ricardo.trindade at emation.pt Mon Apr 4 09:17:23 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Mon, 04 Apr 2005 16:17:23 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot Message-ID: <42515A83.4050907@emation.pt> Hi, I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most recent stable snapshot), and get the following exception : It looks like rxtx has been compiled with jdk 1.5. If this was indeed the case, I think there is a compilation flag that generates code that runs on older jdks. java.lang.UnsupportedClassVersionError: gnu/io/UnsupportedCommOperationException (Unsupported major.minor version 49.0) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at java.net.URLClassLoader.defineClass(URLClassLoader.java:251) at java.net.URLClassLoader.access$100(URLClassLoader.java:55) at java.net.URLClassLoader$1.run(URLClassLoader.java:194) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:187) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:141) I'm trying to run it with 1.4. thanks Ricardo From taj at www.linux.org.uk Tue Apr 5 00:48:12 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 07:48:12 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42515A83.4050907@emation.pt> References: <42515A83.4050907@emation.pt> Message-ID: On Mon, 4 Apr 2005, Ricardo Trindade wrote: > Hi, > > I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most > recent stable snapshot), and get the following exception : > > It looks like rxtx has been compiled with jdk 1.5. If this was > indeed the case, I think there is a compilation flag that generates code > that runs on older jdks. > > java.lang.UnsupportedClassVersionError: > gnu/io/UnsupportedCommOperationException (Unsupported major.minor > version 49.0) [snip] Thanks Ricardo I recompiled the jar with javac -source 1.3 -target 1.3. That should cover most of the JRE's in use today. I also compiled the rxtx 2.0 x86_64 native library which appeared to be missing. I tried looking for flags to pass gcc 4.0 to make the native libraries more backwards compatible but only found options for C++ which is not used in rxtx. I've got a list of other bugs that I'll be going through in the next few weeks but for now I just left them with the same CVS filename - no code changes. ftp://ftp.qbang.org/pub/rxtx/rxtx-2.0-CVS-20050120-bins.tar.gz ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-CVS-20050120-bins.tar.gz -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Tue Apr 5 02:24:33 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 05 Apr 2005 09:24:33 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: References: <42515A83.4050907@emation.pt> Message-ID: <42524B41.3040300@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050405/5919abbb/attachment-0138.html From taj at www.linux.org.uk Tue Apr 5 03:00:29 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 10:00:29 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42524B41.3040300@emation.pt> References: <42515A83.4050907@emation.pt> <42524B41.3040300@emation.pt> Message-ID: On Tue, 5 Apr 2005, Ricardo Trindade wrote: > Will you anounce to the list when a new release is available ? > There will be several incremental releases announced here. Once those are done, we will release 2.1.7 and 2.0.7. -- Trent Jarvi taj at www.linux.org.uk From no_spam at somewhere.com Tue Apr 5 11:55:37 2005 From: no_spam at somewhere.com (no_spam@somewhere.com) Date: Tue, 5 Apr 2005 13:55:37 -0400 Subject: [Rxtx] Closing a port from an event listener results in a deadlock Message-ID: <20050405175537.GA21747@rcog.homelinux.net> On the message I sent on March 14, does anyone had the chance to try the modification? Or was it already fixed? (I haven't searched the archive extensively) Or maybe my message got catched by some spam filters? (it made it to the list archive though) Anyway, I would appreciate some feedback (through the list) Thanks From taj at www.linux.org.uk Tue Apr 5 14:42:28 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 21:42:28 +0100 (BST) Subject: [Rxtx] Closing a port from an event listener results in a deadlock In-Reply-To: <20050405175537.GA21747@rcog.homelinux.net> References: <20050405175537.GA21747@rcog.homelinux.net> Message-ID: On Tue, 5 Apr 2005 no_spam at somewhere.com wrote: > On the message I sent on March 14, does anyone had the chance to try the > modification? > > Or was it already fixed? (I haven't searched the archive extensively) > > Or maybe my message got catched by some spam filters? (it made it to the list > archive though) > > Anyway, I would appreciate some feedback (through the list) > The patch is here http://marc.theaimsgroup.com/?l=rxtx&m=111084488820288&w=2 I have applied this patch to a local copy but will not be doing formal testing for a couple weeks. I do not try to close ports from inside the eventListenter usually so I encourage any feedback also. If there are no problems reported, I expect this will go into rxtx 2.1-7. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Wed Apr 6 08:33:42 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Wed, 06 Apr 2005 15:33:42 +0100 Subject: [Rxtx] getting RXTX version Message-ID: <4253F346.50102@emation.pt> Hi, I want to make sure my deployments have the same version of RXTX jar and native lib. I know the version of the jar can be obtained in the Version class, but how can I obtain the native version ? I know RXTX prints to the console a warning if the version is different. Is there a way to programatically know is this is the case ? I would like to log that to our app's log thanks Ricardo From taj at www.linux.org.uk Wed Apr 6 15:10:20 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 6 Apr 2005 22:10:20 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4253F346.50102@emation.pt> References: <4253F346.50102@emation.pt> Message-ID: On Wed, 6 Apr 2005, Ricardo Trindade wrote: > Hi, > > I want to make sure my deployments have the same version of RXTX jar > and native lib. > > I know the version of the jar can be obtained in the Version class, > but how can I obtain the native version ? > > I know RXTX prints to the console a warning if the version is > different. Is there a way to programatically know is this is the case ? > > I would like to log that to our app's log > There isn't a suggested way of doing that right now. We could move things around and have a static String RXTXVersion.getNativeVersion() in future releases. Is this what you expected? This is not documented in commapi at all. I just tossed that in to catch conflicts while developing. It would be nice to have access in GUI applications though. It may be possible to access RXTXCommDriver.LibVersion right now. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Thu Apr 7 02:51:00 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 09:51:00 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> Message-ID: <4254F474.7020905@emation.pt> >There isn't a suggested way of doing that right now. We could move things >around and have a static String RXTXVersion.getNativeVersion() in future >releases. Is this what you expected? > > Yes, that would be perfect. >This is not documented in commapi at all. I just tossed that in to catch >conflicts while developing. It would be nice to have access in GUI >applications though. > >It may be possible to access RXTXCommDriver.LibVersion right now. > > > I tried, and I don't think it's possible. From taj at www.linux.org.uk Thu Apr 7 03:32:04 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 7 Apr 2005 10:32:04 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4254F474.7020905@emation.pt> References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: On Thu, 7 Apr 2005, Ricardo Trindade wrote: > > >There isn't a suggested way of doing that right now. We could move things > >around and have a static String RXTXVersion.getNativeVersion() in future > >releases. Is this what you expected? > > > > > > Yes, that would be perfect. > The attached should do what you want. You will still need to catch an exception for older versions... -- Trent Jarvi taj at www.linux.org.uk -------------- next part -------------- ? public_version.patch Index: RXTXCommDriver.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXCommDriver.java,v retrieving revision 1.16.2.51 diff -u -r1.16.2.51 RXTXCommDriver.java --- RXTXCommDriver.java 12 Oct 2004 09:13:30 -0000 1.16.2.51 +++ RXTXCommDriver.java 7 Apr 2005 09:29:04 -0000 @@ -54,7 +54,7 @@ the Library. */ String JarVersion = RXTXVersion.getVersion(); - String LibVersion = nativeGetVersion(); + String LibVersion = RXTXVersion.nativeGetVersion(); if ( devel ) { System.out.println("Devel Library"); @@ -76,7 +76,6 @@ /** Get the Serial port prefixes for the running OS */ private String deviceDirectory; private String osName; - private static native String nativeGetVersion(); private native boolean registerKnownPorts(int PortType); private native boolean isPortPrefixValid(String dev); private native boolean testRead(String dev, int type); Index: RXTXVersion.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXVersion.java,v retrieving revision 1.2.2.31 diff -u -r1.2.2.31 RXTXVersion.java --- RXTXVersion.java 16 Oct 2004 16:20:35 -0000 1.2.2.31 +++ RXTXVersion.java 7 Apr 2005 09:29:04 -0000 @@ -36,6 +36,7 @@ private static String Version; static { + System.loadLibrary( "rxtxSerial" ); Version = "RXTX-2.1-7pre20"; } /** @@ -47,4 +48,5 @@ { return(Version); } + public static native String nativeGetVersion(); } Index: SerialImp.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v retrieving revision 1.46.2.181 diff -u -r1.46.2.181 SerialImp.c --- SerialImp.c 17 Oct 2004 09:48:56 -0000 1.46.2.181 +++ SerialImp.c 7 Apr 2005 09:29:07 -0000 @@ -116,6 +116,7 @@ * It will eventually be removed. * */ #define RXTXPort(foo) Java_gnu_io_RXTXPort_ ## foo +#define RXTXVersion(foo) Java_gnu_io_RXTXVersion_ ## foo #define RXTXCommDriver(foo) Java_gnu_io_RXTXCommDriver_ ## foo #if defined(__sun__) || defined(__hpux__) @@ -4001,7 +4002,7 @@ } /*---------------------------------------------------------- -RXTXCommDriver.nativeGetVersion +RXTXVersion.nativeGetVersion accept: none perform: return the current version @@ -4010,9 +4011,10 @@ comments: This is used to avoid mixing versions of the .jar and native library. First introduced in rxtx-1.5-9 + Moved from RXTXCommDriver to RXTXVersion in rxtx-2.1-7 ----------------------------------------------------------*/ -JNIEXPORT jstring JNICALL RXTXCommDriver(nativeGetVersion) (JNIEnv *env, +JNIEXPORT jstring JNICALL RXTXVersion(nativeGetVersion) (JNIEnv *env, jclass jclazz ) { return (*env)->NewStringUTF( env, "RXTX-2.1-7pre20" ); From ricardo.trindade at emation.pt Thu Apr 7 03:45:58 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 10:45:58 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: <42550156.2040908@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050407/05212451/attachment-0138.html From thomas.shulok at lmco.com Thu Apr 7 17:43:11 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Thu, 07 Apr 2005 19:43:11 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi There, I'm attempting to talk RS232 between an embedded Linux box and a Windows box. Everything connects up fine, and I can send and receive a simple sequence of bytes with no problems. However, if around 5 seconds goes by without me sending something, I get the following when I attempt to send. java.io.IOException: Input/output error in writeArray Stack trace: java/lang/Throwable.()V java/lang/Throwable.(Ljava/lang/String;)V java/io/IOException.(Ljava/lang/String;)V gnu/io/RXTXPort.writeArray([BIIZ)V gnu/io/RXTXPort$SerialOutputStream.write([B)V SerialTest.main([Ljava/lang/String;)V If there interval is shorter (say 2 seconds between sends), I have no problems. On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and librxtxSerial-2.0.7pre2.so. Any ideas? Thanks, Thom -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5b23dcf/attachment-0138.html From taj at www.linux.org.uk Thu Apr 7 19:22:36 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:22:36 +0100 (BST) Subject: [Rxtx] Input/output error in writeArray In-Reply-To: References: Message-ID: On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a Windows > box. Everything connects up fine, and I can send and receive a simple > sequence of bytes with no problems. However, if around 5 seconds goes > by without me sending something, I get the following when I attempt to > send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Apr 7 19:24:59 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:24:59 +0100 (BST) Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) Message-ID: hmm. This would not work from applets would it? -- Trent Jarvi taj at www.linux.org.uk ---------- Forwarded message ---------- Date: Thu, 07 Apr 2005 16:05:53 -0400 From: Chris Gaffney To: taj at www.linux.org.uk Subject: RXTX Libraries on Classpath fix Hi, I submitted a patch for RXTX a few weeks ago to allow for loading the native libraries from the classpath. Since sending it to you I found it wasn't working on windows. I've fixed the problem and created a new patch that should replace the older one. The actual change is a one line from a String.equals() to a String.startsWith(). Thanks for a great piece of software, -Chris Gaffney Grand Valley State University -------------- next part -------------- A non-text attachment was scrubbed... Name: libraries_on_classpath_fixed.patch Type: text/x-patch Size: 5617 bytes Desc: Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5d423b8/libraries_on_classpath_fixed-0138.bin From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From thomas.shulok at lmco.com Fri Apr 8 10:38:55 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Fri, 08 Apr 2005 12:38:55 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi Trent, Thanks for the prompt response. Before diving deeper, I was wondering if there is a timeout parameter somewhere in the stack that I have not set properly. Given the nature of the failure (only fails if the line has been idle for a few seconds), it feels like some kind of timeout issue... Thanks again, Thom -----Original Message----- From: rxtx-bounces at mail.linuxgrrls.org [mailto:rxtx-bounces at mail.linuxgrrls.org] On Behalf Of Trent Jarvi Sent: Thursday, April 07, 2005 6:23 PM To: Java RXTX discussion Subject: Re: [Rxtx] Input/output error in writeArray On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a > Windows box. Everything connects up fine, and I can send and receive > a simple sequence of bytes with no problems. However, if around 5 > seconds goes by without me sending something, I get the following when > I attempt to send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at mail.linuxgrrls.org http://mail.linuxgrrls.org/mailman/listinfo/rxtx From ricardo.trindade at emation.pt Mon Apr 4 09:17:23 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Mon, 04 Apr 2005 16:17:23 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot Message-ID: <42515A83.4050907@emation.pt> Hi, I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most recent stable snapshot), and get the following exception : It looks like rxtx has been compiled with jdk 1.5. If this was indeed the case, I think there is a compilation flag that generates code that runs on older jdks. java.lang.UnsupportedClassVersionError: gnu/io/UnsupportedCommOperationException (Unsupported major.minor version 49.0) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at java.net.URLClassLoader.defineClass(URLClassLoader.java:251) at java.net.URLClassLoader.access$100(URLClassLoader.java:55) at java.net.URLClassLoader$1.run(URLClassLoader.java:194) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:187) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:141) I'm trying to run it with 1.4. thanks Ricardo From taj at www.linux.org.uk Tue Apr 5 00:48:12 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 07:48:12 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42515A83.4050907@emation.pt> References: <42515A83.4050907@emation.pt> Message-ID: On Mon, 4 Apr 2005, Ricardo Trindade wrote: > Hi, > > I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most > recent stable snapshot), and get the following exception : > > It looks like rxtx has been compiled with jdk 1.5. If this was > indeed the case, I think there is a compilation flag that generates code > that runs on older jdks. > > java.lang.UnsupportedClassVersionError: > gnu/io/UnsupportedCommOperationException (Unsupported major.minor > version 49.0) [snip] Thanks Ricardo I recompiled the jar with javac -source 1.3 -target 1.3. That should cover most of the JRE's in use today. I also compiled the rxtx 2.0 x86_64 native library which appeared to be missing. I tried looking for flags to pass gcc 4.0 to make the native libraries more backwards compatible but only found options for C++ which is not used in rxtx. I've got a list of other bugs that I'll be going through in the next few weeks but for now I just left them with the same CVS filename - no code changes. ftp://ftp.qbang.org/pub/rxtx/rxtx-2.0-CVS-20050120-bins.tar.gz ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-CVS-20050120-bins.tar.gz -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Tue Apr 5 02:24:33 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 05 Apr 2005 09:24:33 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: References: <42515A83.4050907@emation.pt> Message-ID: <42524B41.3040300@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050405/5919abbb/attachment-0139.html From taj at www.linux.org.uk Tue Apr 5 03:00:29 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 10:00:29 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42524B41.3040300@emation.pt> References: <42515A83.4050907@emation.pt> <42524B41.3040300@emation.pt> Message-ID: On Tue, 5 Apr 2005, Ricardo Trindade wrote: > Will you anounce to the list when a new release is available ? > There will be several incremental releases announced here. Once those are done, we will release 2.1.7 and 2.0.7. -- Trent Jarvi taj at www.linux.org.uk From no_spam at somewhere.com Tue Apr 5 11:55:37 2005 From: no_spam at somewhere.com (no_spam@somewhere.com) Date: Tue, 5 Apr 2005 13:55:37 -0400 Subject: [Rxtx] Closing a port from an event listener results in a deadlock Message-ID: <20050405175537.GA21747@rcog.homelinux.net> On the message I sent on March 14, does anyone had the chance to try the modification? Or was it already fixed? (I haven't searched the archive extensively) Or maybe my message got catched by some spam filters? (it made it to the list archive though) Anyway, I would appreciate some feedback (through the list) Thanks From taj at www.linux.org.uk Tue Apr 5 14:42:28 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 21:42:28 +0100 (BST) Subject: [Rxtx] Closing a port from an event listener results in a deadlock In-Reply-To: <20050405175537.GA21747@rcog.homelinux.net> References: <20050405175537.GA21747@rcog.homelinux.net> Message-ID: On Tue, 5 Apr 2005 no_spam at somewhere.com wrote: > On the message I sent on March 14, does anyone had the chance to try the > modification? > > Or was it already fixed? (I haven't searched the archive extensively) > > Or maybe my message got catched by some spam filters? (it made it to the list > archive though) > > Anyway, I would appreciate some feedback (through the list) > The patch is here http://marc.theaimsgroup.com/?l=rxtx&m=111084488820288&w=2 I have applied this patch to a local copy but will not be doing formal testing for a couple weeks. I do not try to close ports from inside the eventListenter usually so I encourage any feedback also. If there are no problems reported, I expect this will go into rxtx 2.1-7. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Wed Apr 6 08:33:42 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Wed, 06 Apr 2005 15:33:42 +0100 Subject: [Rxtx] getting RXTX version Message-ID: <4253F346.50102@emation.pt> Hi, I want to make sure my deployments have the same version of RXTX jar and native lib. I know the version of the jar can be obtained in the Version class, but how can I obtain the native version ? I know RXTX prints to the console a warning if the version is different. Is there a way to programatically know is this is the case ? I would like to log that to our app's log thanks Ricardo From taj at www.linux.org.uk Wed Apr 6 15:10:20 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 6 Apr 2005 22:10:20 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4253F346.50102@emation.pt> References: <4253F346.50102@emation.pt> Message-ID: On Wed, 6 Apr 2005, Ricardo Trindade wrote: > Hi, > > I want to make sure my deployments have the same version of RXTX jar > and native lib. > > I know the version of the jar can be obtained in the Version class, > but how can I obtain the native version ? > > I know RXTX prints to the console a warning if the version is > different. Is there a way to programatically know is this is the case ? > > I would like to log that to our app's log > There isn't a suggested way of doing that right now. We could move things around and have a static String RXTXVersion.getNativeVersion() in future releases. Is this what you expected? This is not documented in commapi at all. I just tossed that in to catch conflicts while developing. It would be nice to have access in GUI applications though. It may be possible to access RXTXCommDriver.LibVersion right now. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Thu Apr 7 02:51:00 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 09:51:00 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> Message-ID: <4254F474.7020905@emation.pt> >There isn't a suggested way of doing that right now. We could move things >around and have a static String RXTXVersion.getNativeVersion() in future >releases. Is this what you expected? > > Yes, that would be perfect. >This is not documented in commapi at all. I just tossed that in to catch >conflicts while developing. It would be nice to have access in GUI >applications though. > >It may be possible to access RXTXCommDriver.LibVersion right now. > > > I tried, and I don't think it's possible. From taj at www.linux.org.uk Thu Apr 7 03:32:04 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 7 Apr 2005 10:32:04 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4254F474.7020905@emation.pt> References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: On Thu, 7 Apr 2005, Ricardo Trindade wrote: > > >There isn't a suggested way of doing that right now. We could move things > >around and have a static String RXTXVersion.getNativeVersion() in future > >releases. Is this what you expected? > > > > > > Yes, that would be perfect. > The attached should do what you want. You will still need to catch an exception for older versions... -- Trent Jarvi taj at www.linux.org.uk -------------- next part -------------- ? public_version.patch Index: RXTXCommDriver.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXCommDriver.java,v retrieving revision 1.16.2.51 diff -u -r1.16.2.51 RXTXCommDriver.java --- RXTXCommDriver.java 12 Oct 2004 09:13:30 -0000 1.16.2.51 +++ RXTXCommDriver.java 7 Apr 2005 09:29:04 -0000 @@ -54,7 +54,7 @@ the Library. */ String JarVersion = RXTXVersion.getVersion(); - String LibVersion = nativeGetVersion(); + String LibVersion = RXTXVersion.nativeGetVersion(); if ( devel ) { System.out.println("Devel Library"); @@ -76,7 +76,6 @@ /** Get the Serial port prefixes for the running OS */ private String deviceDirectory; private String osName; - private static native String nativeGetVersion(); private native boolean registerKnownPorts(int PortType); private native boolean isPortPrefixValid(String dev); private native boolean testRead(String dev, int type); Index: RXTXVersion.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXVersion.java,v retrieving revision 1.2.2.31 diff -u -r1.2.2.31 RXTXVersion.java --- RXTXVersion.java 16 Oct 2004 16:20:35 -0000 1.2.2.31 +++ RXTXVersion.java 7 Apr 2005 09:29:04 -0000 @@ -36,6 +36,7 @@ private static String Version; static { + System.loadLibrary( "rxtxSerial" ); Version = "RXTX-2.1-7pre20"; } /** @@ -47,4 +48,5 @@ { return(Version); } + public static native String nativeGetVersion(); } Index: SerialImp.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v retrieving revision 1.46.2.181 diff -u -r1.46.2.181 SerialImp.c --- SerialImp.c 17 Oct 2004 09:48:56 -0000 1.46.2.181 +++ SerialImp.c 7 Apr 2005 09:29:07 -0000 @@ -116,6 +116,7 @@ * It will eventually be removed. * */ #define RXTXPort(foo) Java_gnu_io_RXTXPort_ ## foo +#define RXTXVersion(foo) Java_gnu_io_RXTXVersion_ ## foo #define RXTXCommDriver(foo) Java_gnu_io_RXTXCommDriver_ ## foo #if defined(__sun__) || defined(__hpux__) @@ -4001,7 +4002,7 @@ } /*---------------------------------------------------------- -RXTXCommDriver.nativeGetVersion +RXTXVersion.nativeGetVersion accept: none perform: return the current version @@ -4010,9 +4011,10 @@ comments: This is used to avoid mixing versions of the .jar and native library. First introduced in rxtx-1.5-9 + Moved from RXTXCommDriver to RXTXVersion in rxtx-2.1-7 ----------------------------------------------------------*/ -JNIEXPORT jstring JNICALL RXTXCommDriver(nativeGetVersion) (JNIEnv *env, +JNIEXPORT jstring JNICALL RXTXVersion(nativeGetVersion) (JNIEnv *env, jclass jclazz ) { return (*env)->NewStringUTF( env, "RXTX-2.1-7pre20" ); From ricardo.trindade at emation.pt Thu Apr 7 03:45:58 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 10:45:58 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: <42550156.2040908@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050407/05212451/attachment-0139.html From thomas.shulok at lmco.com Thu Apr 7 17:43:11 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Thu, 07 Apr 2005 19:43:11 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi There, I'm attempting to talk RS232 between an embedded Linux box and a Windows box. Everything connects up fine, and I can send and receive a simple sequence of bytes with no problems. However, if around 5 seconds goes by without me sending something, I get the following when I attempt to send. java.io.IOException: Input/output error in writeArray Stack trace: java/lang/Throwable.()V java/lang/Throwable.(Ljava/lang/String;)V java/io/IOException.(Ljava/lang/String;)V gnu/io/RXTXPort.writeArray([BIIZ)V gnu/io/RXTXPort$SerialOutputStream.write([B)V SerialTest.main([Ljava/lang/String;)V If there interval is shorter (say 2 seconds between sends), I have no problems. On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and librxtxSerial-2.0.7pre2.so. Any ideas? Thanks, Thom -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5b23dcf/attachment-0139.html From taj at www.linux.org.uk Thu Apr 7 19:22:36 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:22:36 +0100 (BST) Subject: [Rxtx] Input/output error in writeArray In-Reply-To: References: Message-ID: On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a Windows > box. Everything connects up fine, and I can send and receive a simple > sequence of bytes with no problems. However, if around 5 seconds goes > by without me sending something, I get the following when I attempt to > send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Apr 7 19:24:59 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:24:59 +0100 (BST) Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) Message-ID: hmm. This would not work from applets would it? -- Trent Jarvi taj at www.linux.org.uk ---------- Forwarded message ---------- Date: Thu, 07 Apr 2005 16:05:53 -0400 From: Chris Gaffney To: taj at www.linux.org.uk Subject: RXTX Libraries on Classpath fix Hi, I submitted a patch for RXTX a few weeks ago to allow for loading the native libraries from the classpath. Since sending it to you I found it wasn't working on windows. I've fixed the problem and created a new patch that should replace the older one. The actual change is a one line from a String.equals() to a String.startsWith(). Thanks for a great piece of software, -Chris Gaffney Grand Valley State University -------------- next part -------------- A non-text attachment was scrubbed... Name: libraries_on_classpath_fixed.patch Type: text/x-patch Size: 5617 bytes Desc: Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5d423b8/libraries_on_classpath_fixed-0139.bin From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From thomas.shulok at lmco.com Fri Apr 8 10:38:55 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Fri, 08 Apr 2005 12:38:55 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi Trent, Thanks for the prompt response. Before diving deeper, I was wondering if there is a timeout parameter somewhere in the stack that I have not set properly. Given the nature of the failure (only fails if the line has been idle for a few seconds), it feels like some kind of timeout issue... Thanks again, Thom -----Original Message----- From: rxtx-bounces at mail.linuxgrrls.org [mailto:rxtx-bounces at mail.linuxgrrls.org] On Behalf Of Trent Jarvi Sent: Thursday, April 07, 2005 6:23 PM To: Java RXTX discussion Subject: Re: [Rxtx] Input/output error in writeArray On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a > Windows box. Everything connects up fine, and I can send and receive > a simple sequence of bytes with no problems. However, if around 5 > seconds goes by without me sending something, I get the following when > I attempt to send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at mail.linuxgrrls.org http://mail.linuxgrrls.org/mailman/listinfo/rxtx From ricardo.trindade at emation.pt Mon Apr 4 09:17:23 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Mon, 04 Apr 2005 16:17:23 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot Message-ID: <42515A83.4050907@emation.pt> Hi, I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most recent stable snapshot), and get the following exception : It looks like rxtx has been compiled with jdk 1.5. If this was indeed the case, I think there is a compilation flag that generates code that runs on older jdks. java.lang.UnsupportedClassVersionError: gnu/io/UnsupportedCommOperationException (Unsupported major.minor version 49.0) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at java.net.URLClassLoader.defineClass(URLClassLoader.java:251) at java.net.URLClassLoader.access$100(URLClassLoader.java:55) at java.net.URLClassLoader$1.run(URLClassLoader.java:194) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:187) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:141) I'm trying to run it with 1.4. thanks Ricardo From taj at www.linux.org.uk Tue Apr 5 00:48:12 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 07:48:12 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42515A83.4050907@emation.pt> References: <42515A83.4050907@emation.pt> Message-ID: On Mon, 4 Apr 2005, Ricardo Trindade wrote: > Hi, > > I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most > recent stable snapshot), and get the following exception : > > It looks like rxtx has been compiled with jdk 1.5. If this was > indeed the case, I think there is a compilation flag that generates code > that runs on older jdks. > > java.lang.UnsupportedClassVersionError: > gnu/io/UnsupportedCommOperationException (Unsupported major.minor > version 49.0) [snip] Thanks Ricardo I recompiled the jar with javac -source 1.3 -target 1.3. That should cover most of the JRE's in use today. I also compiled the rxtx 2.0 x86_64 native library which appeared to be missing. I tried looking for flags to pass gcc 4.0 to make the native libraries more backwards compatible but only found options for C++ which is not used in rxtx. I've got a list of other bugs that I'll be going through in the next few weeks but for now I just left them with the same CVS filename - no code changes. ftp://ftp.qbang.org/pub/rxtx/rxtx-2.0-CVS-20050120-bins.tar.gz ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-CVS-20050120-bins.tar.gz -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Tue Apr 5 02:24:33 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 05 Apr 2005 09:24:33 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: References: <42515A83.4050907@emation.pt> Message-ID: <42524B41.3040300@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050405/5919abbb/attachment-0140.html From taj at www.linux.org.uk Tue Apr 5 03:00:29 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 10:00:29 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42524B41.3040300@emation.pt> References: <42515A83.4050907@emation.pt> <42524B41.3040300@emation.pt> Message-ID: On Tue, 5 Apr 2005, Ricardo Trindade wrote: > Will you anounce to the list when a new release is available ? > There will be several incremental releases announced here. Once those are done, we will release 2.1.7 and 2.0.7. -- Trent Jarvi taj at www.linux.org.uk From no_spam at somewhere.com Tue Apr 5 11:55:37 2005 From: no_spam at somewhere.com (no_spam@somewhere.com) Date: Tue, 5 Apr 2005 13:55:37 -0400 Subject: [Rxtx] Closing a port from an event listener results in a deadlock Message-ID: <20050405175537.GA21747@rcog.homelinux.net> On the message I sent on March 14, does anyone had the chance to try the modification? Or was it already fixed? (I haven't searched the archive extensively) Or maybe my message got catched by some spam filters? (it made it to the list archive though) Anyway, I would appreciate some feedback (through the list) Thanks From taj at www.linux.org.uk Tue Apr 5 14:42:28 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 21:42:28 +0100 (BST) Subject: [Rxtx] Closing a port from an event listener results in a deadlock In-Reply-To: <20050405175537.GA21747@rcog.homelinux.net> References: <20050405175537.GA21747@rcog.homelinux.net> Message-ID: On Tue, 5 Apr 2005 no_spam at somewhere.com wrote: > On the message I sent on March 14, does anyone had the chance to try the > modification? > > Or was it already fixed? (I haven't searched the archive extensively) > > Or maybe my message got catched by some spam filters? (it made it to the list > archive though) > > Anyway, I would appreciate some feedback (through the list) > The patch is here http://marc.theaimsgroup.com/?l=rxtx&m=111084488820288&w=2 I have applied this patch to a local copy but will not be doing formal testing for a couple weeks. I do not try to close ports from inside the eventListenter usually so I encourage any feedback also. If there are no problems reported, I expect this will go into rxtx 2.1-7. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Wed Apr 6 08:33:42 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Wed, 06 Apr 2005 15:33:42 +0100 Subject: [Rxtx] getting RXTX version Message-ID: <4253F346.50102@emation.pt> Hi, I want to make sure my deployments have the same version of RXTX jar and native lib. I know the version of the jar can be obtained in the Version class, but how can I obtain the native version ? I know RXTX prints to the console a warning if the version is different. Is there a way to programatically know is this is the case ? I would like to log that to our app's log thanks Ricardo From taj at www.linux.org.uk Wed Apr 6 15:10:20 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 6 Apr 2005 22:10:20 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4253F346.50102@emation.pt> References: <4253F346.50102@emation.pt> Message-ID: On Wed, 6 Apr 2005, Ricardo Trindade wrote: > Hi, > > I want to make sure my deployments have the same version of RXTX jar > and native lib. > > I know the version of the jar can be obtained in the Version class, > but how can I obtain the native version ? > > I know RXTX prints to the console a warning if the version is > different. Is there a way to programatically know is this is the case ? > > I would like to log that to our app's log > There isn't a suggested way of doing that right now. We could move things around and have a static String RXTXVersion.getNativeVersion() in future releases. Is this what you expected? This is not documented in commapi at all. I just tossed that in to catch conflicts while developing. It would be nice to have access in GUI applications though. It may be possible to access RXTXCommDriver.LibVersion right now. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Thu Apr 7 02:51:00 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 09:51:00 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> Message-ID: <4254F474.7020905@emation.pt> >There isn't a suggested way of doing that right now. We could move things >around and have a static String RXTXVersion.getNativeVersion() in future >releases. Is this what you expected? > > Yes, that would be perfect. >This is not documented in commapi at all. I just tossed that in to catch >conflicts while developing. It would be nice to have access in GUI >applications though. > >It may be possible to access RXTXCommDriver.LibVersion right now. > > > I tried, and I don't think it's possible. From taj at www.linux.org.uk Thu Apr 7 03:32:04 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 7 Apr 2005 10:32:04 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4254F474.7020905@emation.pt> References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: On Thu, 7 Apr 2005, Ricardo Trindade wrote: > > >There isn't a suggested way of doing that right now. We could move things > >around and have a static String RXTXVersion.getNativeVersion() in future > >releases. Is this what you expected? > > > > > > Yes, that would be perfect. > The attached should do what you want. You will still need to catch an exception for older versions... -- Trent Jarvi taj at www.linux.org.uk -------------- next part -------------- ? public_version.patch Index: RXTXCommDriver.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXCommDriver.java,v retrieving revision 1.16.2.51 diff -u -r1.16.2.51 RXTXCommDriver.java --- RXTXCommDriver.java 12 Oct 2004 09:13:30 -0000 1.16.2.51 +++ RXTXCommDriver.java 7 Apr 2005 09:29:04 -0000 @@ -54,7 +54,7 @@ the Library. */ String JarVersion = RXTXVersion.getVersion(); - String LibVersion = nativeGetVersion(); + String LibVersion = RXTXVersion.nativeGetVersion(); if ( devel ) { System.out.println("Devel Library"); @@ -76,7 +76,6 @@ /** Get the Serial port prefixes for the running OS */ private String deviceDirectory; private String osName; - private static native String nativeGetVersion(); private native boolean registerKnownPorts(int PortType); private native boolean isPortPrefixValid(String dev); private native boolean testRead(String dev, int type); Index: RXTXVersion.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXVersion.java,v retrieving revision 1.2.2.31 diff -u -r1.2.2.31 RXTXVersion.java --- RXTXVersion.java 16 Oct 2004 16:20:35 -0000 1.2.2.31 +++ RXTXVersion.java 7 Apr 2005 09:29:04 -0000 @@ -36,6 +36,7 @@ private static String Version; static { + System.loadLibrary( "rxtxSerial" ); Version = "RXTX-2.1-7pre20"; } /** @@ -47,4 +48,5 @@ { return(Version); } + public static native String nativeGetVersion(); } Index: SerialImp.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v retrieving revision 1.46.2.181 diff -u -r1.46.2.181 SerialImp.c --- SerialImp.c 17 Oct 2004 09:48:56 -0000 1.46.2.181 +++ SerialImp.c 7 Apr 2005 09:29:07 -0000 @@ -116,6 +116,7 @@ * It will eventually be removed. * */ #define RXTXPort(foo) Java_gnu_io_RXTXPort_ ## foo +#define RXTXVersion(foo) Java_gnu_io_RXTXVersion_ ## foo #define RXTXCommDriver(foo) Java_gnu_io_RXTXCommDriver_ ## foo #if defined(__sun__) || defined(__hpux__) @@ -4001,7 +4002,7 @@ } /*---------------------------------------------------------- -RXTXCommDriver.nativeGetVersion +RXTXVersion.nativeGetVersion accept: none perform: return the current version @@ -4010,9 +4011,10 @@ comments: This is used to avoid mixing versions of the .jar and native library. First introduced in rxtx-1.5-9 + Moved from RXTXCommDriver to RXTXVersion in rxtx-2.1-7 ----------------------------------------------------------*/ -JNIEXPORT jstring JNICALL RXTXCommDriver(nativeGetVersion) (JNIEnv *env, +JNIEXPORT jstring JNICALL RXTXVersion(nativeGetVersion) (JNIEnv *env, jclass jclazz ) { return (*env)->NewStringUTF( env, "RXTX-2.1-7pre20" ); From ricardo.trindade at emation.pt Thu Apr 7 03:45:58 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 10:45:58 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: <42550156.2040908@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050407/05212451/attachment-0140.html From thomas.shulok at lmco.com Thu Apr 7 17:43:11 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Thu, 07 Apr 2005 19:43:11 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi There, I'm attempting to talk RS232 between an embedded Linux box and a Windows box. Everything connects up fine, and I can send and receive a simple sequence of bytes with no problems. However, if around 5 seconds goes by without me sending something, I get the following when I attempt to send. java.io.IOException: Input/output error in writeArray Stack trace: java/lang/Throwable.()V java/lang/Throwable.(Ljava/lang/String;)V java/io/IOException.(Ljava/lang/String;)V gnu/io/RXTXPort.writeArray([BIIZ)V gnu/io/RXTXPort$SerialOutputStream.write([B)V SerialTest.main([Ljava/lang/String;)V If there interval is shorter (say 2 seconds between sends), I have no problems. On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and librxtxSerial-2.0.7pre2.so. Any ideas? Thanks, Thom -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5b23dcf/attachment-0140.html From taj at www.linux.org.uk Thu Apr 7 19:22:36 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:22:36 +0100 (BST) Subject: [Rxtx] Input/output error in writeArray In-Reply-To: References: Message-ID: On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a Windows > box. Everything connects up fine, and I can send and receive a simple > sequence of bytes with no problems. However, if around 5 seconds goes > by without me sending something, I get the following when I attempt to > send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Apr 7 19:24:59 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:24:59 +0100 (BST) Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) Message-ID: hmm. This would not work from applets would it? -- Trent Jarvi taj at www.linux.org.uk ---------- Forwarded message ---------- Date: Thu, 07 Apr 2005 16:05:53 -0400 From: Chris Gaffney To: taj at www.linux.org.uk Subject: RXTX Libraries on Classpath fix Hi, I submitted a patch for RXTX a few weeks ago to allow for loading the native libraries from the classpath. Since sending it to you I found it wasn't working on windows. I've fixed the problem and created a new patch that should replace the older one. The actual change is a one line from a String.equals() to a String.startsWith(). Thanks for a great piece of software, -Chris Gaffney Grand Valley State University -------------- next part -------------- A non-text attachment was scrubbed... Name: libraries_on_classpath_fixed.patch Type: text/x-patch Size: 5617 bytes Desc: Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5d423b8/libraries_on_classpath_fixed-0140.bin From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From thomas.shulok at lmco.com Fri Apr 8 10:38:55 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Fri, 08 Apr 2005 12:38:55 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi Trent, Thanks for the prompt response. Before diving deeper, I was wondering if there is a timeout parameter somewhere in the stack that I have not set properly. Given the nature of the failure (only fails if the line has been idle for a few seconds), it feels like some kind of timeout issue... Thanks again, Thom -----Original Message----- From: rxtx-bounces at mail.linuxgrrls.org [mailto:rxtx-bounces at mail.linuxgrrls.org] On Behalf Of Trent Jarvi Sent: Thursday, April 07, 2005 6:23 PM To: Java RXTX discussion Subject: Re: [Rxtx] Input/output error in writeArray On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a > Windows box. Everything connects up fine, and I can send and receive > a simple sequence of bytes with no problems. However, if around 5 > seconds goes by without me sending something, I get the following when > I attempt to send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at mail.linuxgrrls.org http://mail.linuxgrrls.org/mailman/listinfo/rxtx From ricardo.trindade at emation.pt Mon Apr 4 09:17:23 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Mon, 04 Apr 2005 16:17:23 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot Message-ID: <42515A83.4050907@emation.pt> Hi, I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most recent stable snapshot), and get the following exception : It looks like rxtx has been compiled with jdk 1.5. If this was indeed the case, I think there is a compilation flag that generates code that runs on older jdks. java.lang.UnsupportedClassVersionError: gnu/io/UnsupportedCommOperationException (Unsupported major.minor version 49.0) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at java.net.URLClassLoader.defineClass(URLClassLoader.java:251) at java.net.URLClassLoader.access$100(URLClassLoader.java:55) at java.net.URLClassLoader$1.run(URLClassLoader.java:194) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:187) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:141) I'm trying to run it with 1.4. thanks Ricardo From taj at www.linux.org.uk Tue Apr 5 00:48:12 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 07:48:12 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42515A83.4050907@emation.pt> References: <42515A83.4050907@emation.pt> Message-ID: On Mon, 4 Apr 2005, Ricardo Trindade wrote: > Hi, > > I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most > recent stable snapshot), and get the following exception : > > It looks like rxtx has been compiled with jdk 1.5. If this was > indeed the case, I think there is a compilation flag that generates code > that runs on older jdks. > > java.lang.UnsupportedClassVersionError: > gnu/io/UnsupportedCommOperationException (Unsupported major.minor > version 49.0) [snip] Thanks Ricardo I recompiled the jar with javac -source 1.3 -target 1.3. That should cover most of the JRE's in use today. I also compiled the rxtx 2.0 x86_64 native library which appeared to be missing. I tried looking for flags to pass gcc 4.0 to make the native libraries more backwards compatible but only found options for C++ which is not used in rxtx. I've got a list of other bugs that I'll be going through in the next few weeks but for now I just left them with the same CVS filename - no code changes. ftp://ftp.qbang.org/pub/rxtx/rxtx-2.0-CVS-20050120-bins.tar.gz ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-CVS-20050120-bins.tar.gz -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Tue Apr 5 02:24:33 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 05 Apr 2005 09:24:33 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: References: <42515A83.4050907@emation.pt> Message-ID: <42524B41.3040300@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050405/5919abbb/attachment-0141.html From taj at www.linux.org.uk Tue Apr 5 03:00:29 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 10:00:29 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42524B41.3040300@emation.pt> References: <42515A83.4050907@emation.pt> <42524B41.3040300@emation.pt> Message-ID: On Tue, 5 Apr 2005, Ricardo Trindade wrote: > Will you anounce to the list when a new release is available ? > There will be several incremental releases announced here. Once those are done, we will release 2.1.7 and 2.0.7. -- Trent Jarvi taj at www.linux.org.uk From no_spam at somewhere.com Tue Apr 5 11:55:37 2005 From: no_spam at somewhere.com (no_spam@somewhere.com) Date: Tue, 5 Apr 2005 13:55:37 -0400 Subject: [Rxtx] Closing a port from an event listener results in a deadlock Message-ID: <20050405175537.GA21747@rcog.homelinux.net> On the message I sent on March 14, does anyone had the chance to try the modification? Or was it already fixed? (I haven't searched the archive extensively) Or maybe my message got catched by some spam filters? (it made it to the list archive though) Anyway, I would appreciate some feedback (through the list) Thanks From taj at www.linux.org.uk Tue Apr 5 14:42:28 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 21:42:28 +0100 (BST) Subject: [Rxtx] Closing a port from an event listener results in a deadlock In-Reply-To: <20050405175537.GA21747@rcog.homelinux.net> References: <20050405175537.GA21747@rcog.homelinux.net> Message-ID: On Tue, 5 Apr 2005 no_spam at somewhere.com wrote: > On the message I sent on March 14, does anyone had the chance to try the > modification? > > Or was it already fixed? (I haven't searched the archive extensively) > > Or maybe my message got catched by some spam filters? (it made it to the list > archive though) > > Anyway, I would appreciate some feedback (through the list) > The patch is here http://marc.theaimsgroup.com/?l=rxtx&m=111084488820288&w=2 I have applied this patch to a local copy but will not be doing formal testing for a couple weeks. I do not try to close ports from inside the eventListenter usually so I encourage any feedback also. If there are no problems reported, I expect this will go into rxtx 2.1-7. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Wed Apr 6 08:33:42 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Wed, 06 Apr 2005 15:33:42 +0100 Subject: [Rxtx] getting RXTX version Message-ID: <4253F346.50102@emation.pt> Hi, I want to make sure my deployments have the same version of RXTX jar and native lib. I know the version of the jar can be obtained in the Version class, but how can I obtain the native version ? I know RXTX prints to the console a warning if the version is different. Is there a way to programatically know is this is the case ? I would like to log that to our app's log thanks Ricardo From taj at www.linux.org.uk Wed Apr 6 15:10:20 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 6 Apr 2005 22:10:20 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4253F346.50102@emation.pt> References: <4253F346.50102@emation.pt> Message-ID: On Wed, 6 Apr 2005, Ricardo Trindade wrote: > Hi, > > I want to make sure my deployments have the same version of RXTX jar > and native lib. > > I know the version of the jar can be obtained in the Version class, > but how can I obtain the native version ? > > I know RXTX prints to the console a warning if the version is > different. Is there a way to programatically know is this is the case ? > > I would like to log that to our app's log > There isn't a suggested way of doing that right now. We could move things around and have a static String RXTXVersion.getNativeVersion() in future releases. Is this what you expected? This is not documented in commapi at all. I just tossed that in to catch conflicts while developing. It would be nice to have access in GUI applications though. It may be possible to access RXTXCommDriver.LibVersion right now. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Thu Apr 7 02:51:00 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 09:51:00 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> Message-ID: <4254F474.7020905@emation.pt> >There isn't a suggested way of doing that right now. We could move things >around and have a static String RXTXVersion.getNativeVersion() in future >releases. Is this what you expected? > > Yes, that would be perfect. >This is not documented in commapi at all. I just tossed that in to catch >conflicts while developing. It would be nice to have access in GUI >applications though. > >It may be possible to access RXTXCommDriver.LibVersion right now. > > > I tried, and I don't think it's possible. From taj at www.linux.org.uk Thu Apr 7 03:32:04 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 7 Apr 2005 10:32:04 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4254F474.7020905@emation.pt> References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: On Thu, 7 Apr 2005, Ricardo Trindade wrote: > > >There isn't a suggested way of doing that right now. We could move things > >around and have a static String RXTXVersion.getNativeVersion() in future > >releases. Is this what you expected? > > > > > > Yes, that would be perfect. > The attached should do what you want. You will still need to catch an exception for older versions... -- Trent Jarvi taj at www.linux.org.uk -------------- next part -------------- ? public_version.patch Index: RXTXCommDriver.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXCommDriver.java,v retrieving revision 1.16.2.51 diff -u -r1.16.2.51 RXTXCommDriver.java --- RXTXCommDriver.java 12 Oct 2004 09:13:30 -0000 1.16.2.51 +++ RXTXCommDriver.java 7 Apr 2005 09:29:04 -0000 @@ -54,7 +54,7 @@ the Library. */ String JarVersion = RXTXVersion.getVersion(); - String LibVersion = nativeGetVersion(); + String LibVersion = RXTXVersion.nativeGetVersion(); if ( devel ) { System.out.println("Devel Library"); @@ -76,7 +76,6 @@ /** Get the Serial port prefixes for the running OS */ private String deviceDirectory; private String osName; - private static native String nativeGetVersion(); private native boolean registerKnownPorts(int PortType); private native boolean isPortPrefixValid(String dev); private native boolean testRead(String dev, int type); Index: RXTXVersion.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXVersion.java,v retrieving revision 1.2.2.31 diff -u -r1.2.2.31 RXTXVersion.java --- RXTXVersion.java 16 Oct 2004 16:20:35 -0000 1.2.2.31 +++ RXTXVersion.java 7 Apr 2005 09:29:04 -0000 @@ -36,6 +36,7 @@ private static String Version; static { + System.loadLibrary( "rxtxSerial" ); Version = "RXTX-2.1-7pre20"; } /** @@ -47,4 +48,5 @@ { return(Version); } + public static native String nativeGetVersion(); } Index: SerialImp.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v retrieving revision 1.46.2.181 diff -u -r1.46.2.181 SerialImp.c --- SerialImp.c 17 Oct 2004 09:48:56 -0000 1.46.2.181 +++ SerialImp.c 7 Apr 2005 09:29:07 -0000 @@ -116,6 +116,7 @@ * It will eventually be removed. * */ #define RXTXPort(foo) Java_gnu_io_RXTXPort_ ## foo +#define RXTXVersion(foo) Java_gnu_io_RXTXVersion_ ## foo #define RXTXCommDriver(foo) Java_gnu_io_RXTXCommDriver_ ## foo #if defined(__sun__) || defined(__hpux__) @@ -4001,7 +4002,7 @@ } /*---------------------------------------------------------- -RXTXCommDriver.nativeGetVersion +RXTXVersion.nativeGetVersion accept: none perform: return the current version @@ -4010,9 +4011,10 @@ comments: This is used to avoid mixing versions of the .jar and native library. First introduced in rxtx-1.5-9 + Moved from RXTXCommDriver to RXTXVersion in rxtx-2.1-7 ----------------------------------------------------------*/ -JNIEXPORT jstring JNICALL RXTXCommDriver(nativeGetVersion) (JNIEnv *env, +JNIEXPORT jstring JNICALL RXTXVersion(nativeGetVersion) (JNIEnv *env, jclass jclazz ) { return (*env)->NewStringUTF( env, "RXTX-2.1-7pre20" ); From ricardo.trindade at emation.pt Thu Apr 7 03:45:58 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 10:45:58 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: <42550156.2040908@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050407/05212451/attachment-0141.html From thomas.shulok at lmco.com Thu Apr 7 17:43:11 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Thu, 07 Apr 2005 19:43:11 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi There, I'm attempting to talk RS232 between an embedded Linux box and a Windows box. Everything connects up fine, and I can send and receive a simple sequence of bytes with no problems. However, if around 5 seconds goes by without me sending something, I get the following when I attempt to send. java.io.IOException: Input/output error in writeArray Stack trace: java/lang/Throwable.()V java/lang/Throwable.(Ljava/lang/String;)V java/io/IOException.(Ljava/lang/String;)V gnu/io/RXTXPort.writeArray([BIIZ)V gnu/io/RXTXPort$SerialOutputStream.write([B)V SerialTest.main([Ljava/lang/String;)V If there interval is shorter (say 2 seconds between sends), I have no problems. On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and librxtxSerial-2.0.7pre2.so. Any ideas? Thanks, Thom -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5b23dcf/attachment-0141.html From taj at www.linux.org.uk Thu Apr 7 19:22:36 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:22:36 +0100 (BST) Subject: [Rxtx] Input/output error in writeArray In-Reply-To: References: Message-ID: On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a Windows > box. Everything connects up fine, and I can send and receive a simple > sequence of bytes with no problems. However, if around 5 seconds goes > by without me sending something, I get the following when I attempt to > send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Apr 7 19:24:59 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:24:59 +0100 (BST) Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) Message-ID: hmm. This would not work from applets would it? -- Trent Jarvi taj at www.linux.org.uk ---------- Forwarded message ---------- Date: Thu, 07 Apr 2005 16:05:53 -0400 From: Chris Gaffney To: taj at www.linux.org.uk Subject: RXTX Libraries on Classpath fix Hi, I submitted a patch for RXTX a few weeks ago to allow for loading the native libraries from the classpath. Since sending it to you I found it wasn't working on windows. I've fixed the problem and created a new patch that should replace the older one. The actual change is a one line from a String.equals() to a String.startsWith(). Thanks for a great piece of software, -Chris Gaffney Grand Valley State University -------------- next part -------------- A non-text attachment was scrubbed... Name: libraries_on_classpath_fixed.patch Type: text/x-patch Size: 5617 bytes Desc: Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5d423b8/libraries_on_classpath_fixed-0141.bin From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From thomas.shulok at lmco.com Fri Apr 8 10:38:55 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Fri, 08 Apr 2005 12:38:55 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi Trent, Thanks for the prompt response. Before diving deeper, I was wondering if there is a timeout parameter somewhere in the stack that I have not set properly. Given the nature of the failure (only fails if the line has been idle for a few seconds), it feels like some kind of timeout issue... Thanks again, Thom -----Original Message----- From: rxtx-bounces at mail.linuxgrrls.org [mailto:rxtx-bounces at mail.linuxgrrls.org] On Behalf Of Trent Jarvi Sent: Thursday, April 07, 2005 6:23 PM To: Java RXTX discussion Subject: Re: [Rxtx] Input/output error in writeArray On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a > Windows box. Everything connects up fine, and I can send and receive > a simple sequence of bytes with no problems. However, if around 5 > seconds goes by without me sending something, I get the following when > I attempt to send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at mail.linuxgrrls.org http://mail.linuxgrrls.org/mailman/listinfo/rxtx From ricardo.trindade at emation.pt Mon Apr 4 09:17:23 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Mon, 04 Apr 2005 16:17:23 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot Message-ID: <42515A83.4050907@emation.pt> Hi, I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most recent stable snapshot), and get the following exception : It looks like rxtx has been compiled with jdk 1.5. If this was indeed the case, I think there is a compilation flag that generates code that runs on older jdks. java.lang.UnsupportedClassVersionError: gnu/io/UnsupportedCommOperationException (Unsupported major.minor version 49.0) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at java.net.URLClassLoader.defineClass(URLClassLoader.java:251) at java.net.URLClassLoader.access$100(URLClassLoader.java:55) at java.net.URLClassLoader$1.run(URLClassLoader.java:194) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:187) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:141) I'm trying to run it with 1.4. thanks Ricardo From taj at www.linux.org.uk Tue Apr 5 00:48:12 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 07:48:12 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42515A83.4050907@emation.pt> References: <42515A83.4050907@emation.pt> Message-ID: On Mon, 4 Apr 2005, Ricardo Trindade wrote: > Hi, > > I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most > recent stable snapshot), and get the following exception : > > It looks like rxtx has been compiled with jdk 1.5. If this was > indeed the case, I think there is a compilation flag that generates code > that runs on older jdks. > > java.lang.UnsupportedClassVersionError: > gnu/io/UnsupportedCommOperationException (Unsupported major.minor > version 49.0) [snip] Thanks Ricardo I recompiled the jar with javac -source 1.3 -target 1.3. That should cover most of the JRE's in use today. I also compiled the rxtx 2.0 x86_64 native library which appeared to be missing. I tried looking for flags to pass gcc 4.0 to make the native libraries more backwards compatible but only found options for C++ which is not used in rxtx. I've got a list of other bugs that I'll be going through in the next few weeks but for now I just left them with the same CVS filename - no code changes. ftp://ftp.qbang.org/pub/rxtx/rxtx-2.0-CVS-20050120-bins.tar.gz ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-CVS-20050120-bins.tar.gz -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Tue Apr 5 02:24:33 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 05 Apr 2005 09:24:33 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: References: <42515A83.4050907@emation.pt> Message-ID: <42524B41.3040300@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050405/5919abbb/attachment-0142.html From taj at www.linux.org.uk Tue Apr 5 03:00:29 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 10:00:29 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42524B41.3040300@emation.pt> References: <42515A83.4050907@emation.pt> <42524B41.3040300@emation.pt> Message-ID: On Tue, 5 Apr 2005, Ricardo Trindade wrote: > Will you anounce to the list when a new release is available ? > There will be several incremental releases announced here. Once those are done, we will release 2.1.7 and 2.0.7. -- Trent Jarvi taj at www.linux.org.uk From no_spam at somewhere.com Tue Apr 5 11:55:37 2005 From: no_spam at somewhere.com (no_spam@somewhere.com) Date: Tue, 5 Apr 2005 13:55:37 -0400 Subject: [Rxtx] Closing a port from an event listener results in a deadlock Message-ID: <20050405175537.GA21747@rcog.homelinux.net> On the message I sent on March 14, does anyone had the chance to try the modification? Or was it already fixed? (I haven't searched the archive extensively) Or maybe my message got catched by some spam filters? (it made it to the list archive though) Anyway, I would appreciate some feedback (through the list) Thanks From taj at www.linux.org.uk Tue Apr 5 14:42:28 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 21:42:28 +0100 (BST) Subject: [Rxtx] Closing a port from an event listener results in a deadlock In-Reply-To: <20050405175537.GA21747@rcog.homelinux.net> References: <20050405175537.GA21747@rcog.homelinux.net> Message-ID: On Tue, 5 Apr 2005 no_spam at somewhere.com wrote: > On the message I sent on March 14, does anyone had the chance to try the > modification? > > Or was it already fixed? (I haven't searched the archive extensively) > > Or maybe my message got catched by some spam filters? (it made it to the list > archive though) > > Anyway, I would appreciate some feedback (through the list) > The patch is here http://marc.theaimsgroup.com/?l=rxtx&m=111084488820288&w=2 I have applied this patch to a local copy but will not be doing formal testing for a couple weeks. I do not try to close ports from inside the eventListenter usually so I encourage any feedback also. If there are no problems reported, I expect this will go into rxtx 2.1-7. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Wed Apr 6 08:33:42 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Wed, 06 Apr 2005 15:33:42 +0100 Subject: [Rxtx] getting RXTX version Message-ID: <4253F346.50102@emation.pt> Hi, I want to make sure my deployments have the same version of RXTX jar and native lib. I know the version of the jar can be obtained in the Version class, but how can I obtain the native version ? I know RXTX prints to the console a warning if the version is different. Is there a way to programatically know is this is the case ? I would like to log that to our app's log thanks Ricardo From taj at www.linux.org.uk Wed Apr 6 15:10:20 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 6 Apr 2005 22:10:20 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4253F346.50102@emation.pt> References: <4253F346.50102@emation.pt> Message-ID: On Wed, 6 Apr 2005, Ricardo Trindade wrote: > Hi, > > I want to make sure my deployments have the same version of RXTX jar > and native lib. > > I know the version of the jar can be obtained in the Version class, > but how can I obtain the native version ? > > I know RXTX prints to the console a warning if the version is > different. Is there a way to programatically know is this is the case ? > > I would like to log that to our app's log > There isn't a suggested way of doing that right now. We could move things around and have a static String RXTXVersion.getNativeVersion() in future releases. Is this what you expected? This is not documented in commapi at all. I just tossed that in to catch conflicts while developing. It would be nice to have access in GUI applications though. It may be possible to access RXTXCommDriver.LibVersion right now. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Thu Apr 7 02:51:00 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 09:51:00 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> Message-ID: <4254F474.7020905@emation.pt> >There isn't a suggested way of doing that right now. We could move things >around and have a static String RXTXVersion.getNativeVersion() in future >releases. Is this what you expected? > > Yes, that would be perfect. >This is not documented in commapi at all. I just tossed that in to catch >conflicts while developing. It would be nice to have access in GUI >applications though. > >It may be possible to access RXTXCommDriver.LibVersion right now. > > > I tried, and I don't think it's possible. From taj at www.linux.org.uk Thu Apr 7 03:32:04 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 7 Apr 2005 10:32:04 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4254F474.7020905@emation.pt> References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: On Thu, 7 Apr 2005, Ricardo Trindade wrote: > > >There isn't a suggested way of doing that right now. We could move things > >around and have a static String RXTXVersion.getNativeVersion() in future > >releases. Is this what you expected? > > > > > > Yes, that would be perfect. > The attached should do what you want. You will still need to catch an exception for older versions... -- Trent Jarvi taj at www.linux.org.uk -------------- next part -------------- ? public_version.patch Index: RXTXCommDriver.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXCommDriver.java,v retrieving revision 1.16.2.51 diff -u -r1.16.2.51 RXTXCommDriver.java --- RXTXCommDriver.java 12 Oct 2004 09:13:30 -0000 1.16.2.51 +++ RXTXCommDriver.java 7 Apr 2005 09:29:04 -0000 @@ -54,7 +54,7 @@ the Library. */ String JarVersion = RXTXVersion.getVersion(); - String LibVersion = nativeGetVersion(); + String LibVersion = RXTXVersion.nativeGetVersion(); if ( devel ) { System.out.println("Devel Library"); @@ -76,7 +76,6 @@ /** Get the Serial port prefixes for the running OS */ private String deviceDirectory; private String osName; - private static native String nativeGetVersion(); private native boolean registerKnownPorts(int PortType); private native boolean isPortPrefixValid(String dev); private native boolean testRead(String dev, int type); Index: RXTXVersion.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXVersion.java,v retrieving revision 1.2.2.31 diff -u -r1.2.2.31 RXTXVersion.java --- RXTXVersion.java 16 Oct 2004 16:20:35 -0000 1.2.2.31 +++ RXTXVersion.java 7 Apr 2005 09:29:04 -0000 @@ -36,6 +36,7 @@ private static String Version; static { + System.loadLibrary( "rxtxSerial" ); Version = "RXTX-2.1-7pre20"; } /** @@ -47,4 +48,5 @@ { return(Version); } + public static native String nativeGetVersion(); } Index: SerialImp.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v retrieving revision 1.46.2.181 diff -u -r1.46.2.181 SerialImp.c --- SerialImp.c 17 Oct 2004 09:48:56 -0000 1.46.2.181 +++ SerialImp.c 7 Apr 2005 09:29:07 -0000 @@ -116,6 +116,7 @@ * It will eventually be removed. * */ #define RXTXPort(foo) Java_gnu_io_RXTXPort_ ## foo +#define RXTXVersion(foo) Java_gnu_io_RXTXVersion_ ## foo #define RXTXCommDriver(foo) Java_gnu_io_RXTXCommDriver_ ## foo #if defined(__sun__) || defined(__hpux__) @@ -4001,7 +4002,7 @@ } /*---------------------------------------------------------- -RXTXCommDriver.nativeGetVersion +RXTXVersion.nativeGetVersion accept: none perform: return the current version @@ -4010,9 +4011,10 @@ comments: This is used to avoid mixing versions of the .jar and native library. First introduced in rxtx-1.5-9 + Moved from RXTXCommDriver to RXTXVersion in rxtx-2.1-7 ----------------------------------------------------------*/ -JNIEXPORT jstring JNICALL RXTXCommDriver(nativeGetVersion) (JNIEnv *env, +JNIEXPORT jstring JNICALL RXTXVersion(nativeGetVersion) (JNIEnv *env, jclass jclazz ) { return (*env)->NewStringUTF( env, "RXTX-2.1-7pre20" ); From ricardo.trindade at emation.pt Thu Apr 7 03:45:58 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 10:45:58 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: <42550156.2040908@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050407/05212451/attachment-0142.html From thomas.shulok at lmco.com Thu Apr 7 17:43:11 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Thu, 07 Apr 2005 19:43:11 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi There, I'm attempting to talk RS232 between an embedded Linux box and a Windows box. Everything connects up fine, and I can send and receive a simple sequence of bytes with no problems. However, if around 5 seconds goes by without me sending something, I get the following when I attempt to send. java.io.IOException: Input/output error in writeArray Stack trace: java/lang/Throwable.()V java/lang/Throwable.(Ljava/lang/String;)V java/io/IOException.(Ljava/lang/String;)V gnu/io/RXTXPort.writeArray([BIIZ)V gnu/io/RXTXPort$SerialOutputStream.write([B)V SerialTest.main([Ljava/lang/String;)V If there interval is shorter (say 2 seconds between sends), I have no problems. On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and librxtxSerial-2.0.7pre2.so. Any ideas? Thanks, Thom -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5b23dcf/attachment-0142.html From taj at www.linux.org.uk Thu Apr 7 19:22:36 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:22:36 +0100 (BST) Subject: [Rxtx] Input/output error in writeArray In-Reply-To: References: Message-ID: On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a Windows > box. Everything connects up fine, and I can send and receive a simple > sequence of bytes with no problems. However, if around 5 seconds goes > by without me sending something, I get the following when I attempt to > send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Apr 7 19:24:59 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:24:59 +0100 (BST) Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) Message-ID: hmm. This would not work from applets would it? -- Trent Jarvi taj at www.linux.org.uk ---------- Forwarded message ---------- Date: Thu, 07 Apr 2005 16:05:53 -0400 From: Chris Gaffney To: taj at www.linux.org.uk Subject: RXTX Libraries on Classpath fix Hi, I submitted a patch for RXTX a few weeks ago to allow for loading the native libraries from the classpath. Since sending it to you I found it wasn't working on windows. I've fixed the problem and created a new patch that should replace the older one. The actual change is a one line from a String.equals() to a String.startsWith(). Thanks for a great piece of software, -Chris Gaffney Grand Valley State University -------------- next part -------------- A non-text attachment was scrubbed... Name: libraries_on_classpath_fixed.patch Type: text/x-patch Size: 5617 bytes Desc: Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5d423b8/libraries_on_classpath_fixed-0142.bin From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From thomas.shulok at lmco.com Fri Apr 8 10:38:55 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Fri, 08 Apr 2005 12:38:55 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi Trent, Thanks for the prompt response. Before diving deeper, I was wondering if there is a timeout parameter somewhere in the stack that I have not set properly. Given the nature of the failure (only fails if the line has been idle for a few seconds), it feels like some kind of timeout issue... Thanks again, Thom -----Original Message----- From: rxtx-bounces at mail.linuxgrrls.org [mailto:rxtx-bounces at mail.linuxgrrls.org] On Behalf Of Trent Jarvi Sent: Thursday, April 07, 2005 6:23 PM To: Java RXTX discussion Subject: Re: [Rxtx] Input/output error in writeArray On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a > Windows box. Everything connects up fine, and I can send and receive > a simple sequence of bytes with no problems. However, if around 5 > seconds goes by without me sending something, I get the following when > I attempt to send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at mail.linuxgrrls.org http://mail.linuxgrrls.org/mailman/listinfo/rxtx From ricardo.trindade at emation.pt Mon Apr 4 09:17:23 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Mon, 04 Apr 2005 16:17:23 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot Message-ID: <42515A83.4050907@emation.pt> Hi, I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most recent stable snapshot), and get the following exception : It looks like rxtx has been compiled with jdk 1.5. If this was indeed the case, I think there is a compilation flag that generates code that runs on older jdks. java.lang.UnsupportedClassVersionError: gnu/io/UnsupportedCommOperationException (Unsupported major.minor version 49.0) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at java.net.URLClassLoader.defineClass(URLClassLoader.java:251) at java.net.URLClassLoader.access$100(URLClassLoader.java:55) at java.net.URLClassLoader$1.run(URLClassLoader.java:194) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:187) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:141) I'm trying to run it with 1.4. thanks Ricardo From taj at www.linux.org.uk Tue Apr 5 00:48:12 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 07:48:12 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42515A83.4050907@emation.pt> References: <42515A83.4050907@emation.pt> Message-ID: On Mon, 4 Apr 2005, Ricardo Trindade wrote: > Hi, > > I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most > recent stable snapshot), and get the following exception : > > It looks like rxtx has been compiled with jdk 1.5. If this was > indeed the case, I think there is a compilation flag that generates code > that runs on older jdks. > > java.lang.UnsupportedClassVersionError: > gnu/io/UnsupportedCommOperationException (Unsupported major.minor > version 49.0) [snip] Thanks Ricardo I recompiled the jar with javac -source 1.3 -target 1.3. That should cover most of the JRE's in use today. I also compiled the rxtx 2.0 x86_64 native library which appeared to be missing. I tried looking for flags to pass gcc 4.0 to make the native libraries more backwards compatible but only found options for C++ which is not used in rxtx. I've got a list of other bugs that I'll be going through in the next few weeks but for now I just left them with the same CVS filename - no code changes. ftp://ftp.qbang.org/pub/rxtx/rxtx-2.0-CVS-20050120-bins.tar.gz ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-CVS-20050120-bins.tar.gz -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Tue Apr 5 02:24:33 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 05 Apr 2005 09:24:33 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: References: <42515A83.4050907@emation.pt> Message-ID: <42524B41.3040300@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050405/5919abbb/attachment-0143.html From taj at www.linux.org.uk Tue Apr 5 03:00:29 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 10:00:29 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42524B41.3040300@emation.pt> References: <42515A83.4050907@emation.pt> <42524B41.3040300@emation.pt> Message-ID: On Tue, 5 Apr 2005, Ricardo Trindade wrote: > Will you anounce to the list when a new release is available ? > There will be several incremental releases announced here. Once those are done, we will release 2.1.7 and 2.0.7. -- Trent Jarvi taj at www.linux.org.uk From no_spam at somewhere.com Tue Apr 5 11:55:37 2005 From: no_spam at somewhere.com (no_spam@somewhere.com) Date: Tue, 5 Apr 2005 13:55:37 -0400 Subject: [Rxtx] Closing a port from an event listener results in a deadlock Message-ID: <20050405175537.GA21747@rcog.homelinux.net> On the message I sent on March 14, does anyone had the chance to try the modification? Or was it already fixed? (I haven't searched the archive extensively) Or maybe my message got catched by some spam filters? (it made it to the list archive though) Anyway, I would appreciate some feedback (through the list) Thanks From taj at www.linux.org.uk Tue Apr 5 14:42:28 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 21:42:28 +0100 (BST) Subject: [Rxtx] Closing a port from an event listener results in a deadlock In-Reply-To: <20050405175537.GA21747@rcog.homelinux.net> References: <20050405175537.GA21747@rcog.homelinux.net> Message-ID: On Tue, 5 Apr 2005 no_spam at somewhere.com wrote: > On the message I sent on March 14, does anyone had the chance to try the > modification? > > Or was it already fixed? (I haven't searched the archive extensively) > > Or maybe my message got catched by some spam filters? (it made it to the list > archive though) > > Anyway, I would appreciate some feedback (through the list) > The patch is here http://marc.theaimsgroup.com/?l=rxtx&m=111084488820288&w=2 I have applied this patch to a local copy but will not be doing formal testing for a couple weeks. I do not try to close ports from inside the eventListenter usually so I encourage any feedback also. If there are no problems reported, I expect this will go into rxtx 2.1-7. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Wed Apr 6 08:33:42 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Wed, 06 Apr 2005 15:33:42 +0100 Subject: [Rxtx] getting RXTX version Message-ID: <4253F346.50102@emation.pt> Hi, I want to make sure my deployments have the same version of RXTX jar and native lib. I know the version of the jar can be obtained in the Version class, but how can I obtain the native version ? I know RXTX prints to the console a warning if the version is different. Is there a way to programatically know is this is the case ? I would like to log that to our app's log thanks Ricardo From taj at www.linux.org.uk Wed Apr 6 15:10:20 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 6 Apr 2005 22:10:20 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4253F346.50102@emation.pt> References: <4253F346.50102@emation.pt> Message-ID: On Wed, 6 Apr 2005, Ricardo Trindade wrote: > Hi, > > I want to make sure my deployments have the same version of RXTX jar > and native lib. > > I know the version of the jar can be obtained in the Version class, > but how can I obtain the native version ? > > I know RXTX prints to the console a warning if the version is > different. Is there a way to programatically know is this is the case ? > > I would like to log that to our app's log > There isn't a suggested way of doing that right now. We could move things around and have a static String RXTXVersion.getNativeVersion() in future releases. Is this what you expected? This is not documented in commapi at all. I just tossed that in to catch conflicts while developing. It would be nice to have access in GUI applications though. It may be possible to access RXTXCommDriver.LibVersion right now. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Thu Apr 7 02:51:00 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 09:51:00 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> Message-ID: <4254F474.7020905@emation.pt> >There isn't a suggested way of doing that right now. We could move things >around and have a static String RXTXVersion.getNativeVersion() in future >releases. Is this what you expected? > > Yes, that would be perfect. >This is not documented in commapi at all. I just tossed that in to catch >conflicts while developing. It would be nice to have access in GUI >applications though. > >It may be possible to access RXTXCommDriver.LibVersion right now. > > > I tried, and I don't think it's possible. From taj at www.linux.org.uk Thu Apr 7 03:32:04 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 7 Apr 2005 10:32:04 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4254F474.7020905@emation.pt> References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: On Thu, 7 Apr 2005, Ricardo Trindade wrote: > > >There isn't a suggested way of doing that right now. We could move things > >around and have a static String RXTXVersion.getNativeVersion() in future > >releases. Is this what you expected? > > > > > > Yes, that would be perfect. > The attached should do what you want. You will still need to catch an exception for older versions... -- Trent Jarvi taj at www.linux.org.uk -------------- next part -------------- ? public_version.patch Index: RXTXCommDriver.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXCommDriver.java,v retrieving revision 1.16.2.51 diff -u -r1.16.2.51 RXTXCommDriver.java --- RXTXCommDriver.java 12 Oct 2004 09:13:30 -0000 1.16.2.51 +++ RXTXCommDriver.java 7 Apr 2005 09:29:04 -0000 @@ -54,7 +54,7 @@ the Library. */ String JarVersion = RXTXVersion.getVersion(); - String LibVersion = nativeGetVersion(); + String LibVersion = RXTXVersion.nativeGetVersion(); if ( devel ) { System.out.println("Devel Library"); @@ -76,7 +76,6 @@ /** Get the Serial port prefixes for the running OS */ private String deviceDirectory; private String osName; - private static native String nativeGetVersion(); private native boolean registerKnownPorts(int PortType); private native boolean isPortPrefixValid(String dev); private native boolean testRead(String dev, int type); Index: RXTXVersion.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXVersion.java,v retrieving revision 1.2.2.31 diff -u -r1.2.2.31 RXTXVersion.java --- RXTXVersion.java 16 Oct 2004 16:20:35 -0000 1.2.2.31 +++ RXTXVersion.java 7 Apr 2005 09:29:04 -0000 @@ -36,6 +36,7 @@ private static String Version; static { + System.loadLibrary( "rxtxSerial" ); Version = "RXTX-2.1-7pre20"; } /** @@ -47,4 +48,5 @@ { return(Version); } + public static native String nativeGetVersion(); } Index: SerialImp.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v retrieving revision 1.46.2.181 diff -u -r1.46.2.181 SerialImp.c --- SerialImp.c 17 Oct 2004 09:48:56 -0000 1.46.2.181 +++ SerialImp.c 7 Apr 2005 09:29:07 -0000 @@ -116,6 +116,7 @@ * It will eventually be removed. * */ #define RXTXPort(foo) Java_gnu_io_RXTXPort_ ## foo +#define RXTXVersion(foo) Java_gnu_io_RXTXVersion_ ## foo #define RXTXCommDriver(foo) Java_gnu_io_RXTXCommDriver_ ## foo #if defined(__sun__) || defined(__hpux__) @@ -4001,7 +4002,7 @@ } /*---------------------------------------------------------- -RXTXCommDriver.nativeGetVersion +RXTXVersion.nativeGetVersion accept: none perform: return the current version @@ -4010,9 +4011,10 @@ comments: This is used to avoid mixing versions of the .jar and native library. First introduced in rxtx-1.5-9 + Moved from RXTXCommDriver to RXTXVersion in rxtx-2.1-7 ----------------------------------------------------------*/ -JNIEXPORT jstring JNICALL RXTXCommDriver(nativeGetVersion) (JNIEnv *env, +JNIEXPORT jstring JNICALL RXTXVersion(nativeGetVersion) (JNIEnv *env, jclass jclazz ) { return (*env)->NewStringUTF( env, "RXTX-2.1-7pre20" ); From ricardo.trindade at emation.pt Thu Apr 7 03:45:58 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 10:45:58 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: <42550156.2040908@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050407/05212451/attachment-0143.html From thomas.shulok at lmco.com Thu Apr 7 17:43:11 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Thu, 07 Apr 2005 19:43:11 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi There, I'm attempting to talk RS232 between an embedded Linux box and a Windows box. Everything connects up fine, and I can send and receive a simple sequence of bytes with no problems. However, if around 5 seconds goes by without me sending something, I get the following when I attempt to send. java.io.IOException: Input/output error in writeArray Stack trace: java/lang/Throwable.()V java/lang/Throwable.(Ljava/lang/String;)V java/io/IOException.(Ljava/lang/String;)V gnu/io/RXTXPort.writeArray([BIIZ)V gnu/io/RXTXPort$SerialOutputStream.write([B)V SerialTest.main([Ljava/lang/String;)V If there interval is shorter (say 2 seconds between sends), I have no problems. On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and librxtxSerial-2.0.7pre2.so. Any ideas? Thanks, Thom -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5b23dcf/attachment-0143.html From taj at www.linux.org.uk Thu Apr 7 19:22:36 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:22:36 +0100 (BST) Subject: [Rxtx] Input/output error in writeArray In-Reply-To: References: Message-ID: On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a Windows > box. Everything connects up fine, and I can send and receive a simple > sequence of bytes with no problems. However, if around 5 seconds goes > by without me sending something, I get the following when I attempt to > send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Apr 7 19:24:59 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:24:59 +0100 (BST) Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) Message-ID: hmm. This would not work from applets would it? -- Trent Jarvi taj at www.linux.org.uk ---------- Forwarded message ---------- Date: Thu, 07 Apr 2005 16:05:53 -0400 From: Chris Gaffney To: taj at www.linux.org.uk Subject: RXTX Libraries on Classpath fix Hi, I submitted a patch for RXTX a few weeks ago to allow for loading the native libraries from the classpath. Since sending it to you I found it wasn't working on windows. I've fixed the problem and created a new patch that should replace the older one. The actual change is a one line from a String.equals() to a String.startsWith(). Thanks for a great piece of software, -Chris Gaffney Grand Valley State University -------------- next part -------------- A non-text attachment was scrubbed... Name: libraries_on_classpath_fixed.patch Type: text/x-patch Size: 5617 bytes Desc: Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5d423b8/libraries_on_classpath_fixed-0143.bin From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From thomas.shulok at lmco.com Fri Apr 8 10:38:55 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Fri, 08 Apr 2005 12:38:55 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi Trent, Thanks for the prompt response. Before diving deeper, I was wondering if there is a timeout parameter somewhere in the stack that I have not set properly. Given the nature of the failure (only fails if the line has been idle for a few seconds), it feels like some kind of timeout issue... Thanks again, Thom -----Original Message----- From: rxtx-bounces at mail.linuxgrrls.org [mailto:rxtx-bounces at mail.linuxgrrls.org] On Behalf Of Trent Jarvi Sent: Thursday, April 07, 2005 6:23 PM To: Java RXTX discussion Subject: Re: [Rxtx] Input/output error in writeArray On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a > Windows box. Everything connects up fine, and I can send and receive > a simple sequence of bytes with no problems. However, if around 5 > seconds goes by without me sending something, I get the following when > I attempt to send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at mail.linuxgrrls.org http://mail.linuxgrrls.org/mailman/listinfo/rxtx From ricardo.trindade at emation.pt Mon Apr 4 09:17:23 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Mon, 04 Apr 2005 16:17:23 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot Message-ID: <42515A83.4050907@emation.pt> Hi, I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most recent stable snapshot), and get the following exception : It looks like rxtx has been compiled with jdk 1.5. If this was indeed the case, I think there is a compilation flag that generates code that runs on older jdks. java.lang.UnsupportedClassVersionError: gnu/io/UnsupportedCommOperationException (Unsupported major.minor version 49.0) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at java.net.URLClassLoader.defineClass(URLClassLoader.java:251) at java.net.URLClassLoader.access$100(URLClassLoader.java:55) at java.net.URLClassLoader$1.run(URLClassLoader.java:194) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:187) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:141) I'm trying to run it with 1.4. thanks Ricardo From taj at www.linux.org.uk Tue Apr 5 00:48:12 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 07:48:12 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42515A83.4050907@emation.pt> References: <42515A83.4050907@emation.pt> Message-ID: On Mon, 4 Apr 2005, Ricardo Trindade wrote: > Hi, > > I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most > recent stable snapshot), and get the following exception : > > It looks like rxtx has been compiled with jdk 1.5. If this was > indeed the case, I think there is a compilation flag that generates code > that runs on older jdks. > > java.lang.UnsupportedClassVersionError: > gnu/io/UnsupportedCommOperationException (Unsupported major.minor > version 49.0) [snip] Thanks Ricardo I recompiled the jar with javac -source 1.3 -target 1.3. That should cover most of the JRE's in use today. I also compiled the rxtx 2.0 x86_64 native library which appeared to be missing. I tried looking for flags to pass gcc 4.0 to make the native libraries more backwards compatible but only found options for C++ which is not used in rxtx. I've got a list of other bugs that I'll be going through in the next few weeks but for now I just left them with the same CVS filename - no code changes. ftp://ftp.qbang.org/pub/rxtx/rxtx-2.0-CVS-20050120-bins.tar.gz ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-CVS-20050120-bins.tar.gz -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Tue Apr 5 02:24:33 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 05 Apr 2005 09:24:33 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: References: <42515A83.4050907@emation.pt> Message-ID: <42524B41.3040300@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050405/5919abbb/attachment-0144.html From taj at www.linux.org.uk Tue Apr 5 03:00:29 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 10:00:29 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42524B41.3040300@emation.pt> References: <42515A83.4050907@emation.pt> <42524B41.3040300@emation.pt> Message-ID: On Tue, 5 Apr 2005, Ricardo Trindade wrote: > Will you anounce to the list when a new release is available ? > There will be several incremental releases announced here. Once those are done, we will release 2.1.7 and 2.0.7. -- Trent Jarvi taj at www.linux.org.uk From no_spam at somewhere.com Tue Apr 5 11:55:37 2005 From: no_spam at somewhere.com (no_spam@somewhere.com) Date: Tue, 5 Apr 2005 13:55:37 -0400 Subject: [Rxtx] Closing a port from an event listener results in a deadlock Message-ID: <20050405175537.GA21747@rcog.homelinux.net> On the message I sent on March 14, does anyone had the chance to try the modification? Or was it already fixed? (I haven't searched the archive extensively) Or maybe my message got catched by some spam filters? (it made it to the list archive though) Anyway, I would appreciate some feedback (through the list) Thanks From taj at www.linux.org.uk Tue Apr 5 14:42:28 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 21:42:28 +0100 (BST) Subject: [Rxtx] Closing a port from an event listener results in a deadlock In-Reply-To: <20050405175537.GA21747@rcog.homelinux.net> References: <20050405175537.GA21747@rcog.homelinux.net> Message-ID: On Tue, 5 Apr 2005 no_spam at somewhere.com wrote: > On the message I sent on March 14, does anyone had the chance to try the > modification? > > Or was it already fixed? (I haven't searched the archive extensively) > > Or maybe my message got catched by some spam filters? (it made it to the list > archive though) > > Anyway, I would appreciate some feedback (through the list) > The patch is here http://marc.theaimsgroup.com/?l=rxtx&m=111084488820288&w=2 I have applied this patch to a local copy but will not be doing formal testing for a couple weeks. I do not try to close ports from inside the eventListenter usually so I encourage any feedback also. If there are no problems reported, I expect this will go into rxtx 2.1-7. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Wed Apr 6 08:33:42 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Wed, 06 Apr 2005 15:33:42 +0100 Subject: [Rxtx] getting RXTX version Message-ID: <4253F346.50102@emation.pt> Hi, I want to make sure my deployments have the same version of RXTX jar and native lib. I know the version of the jar can be obtained in the Version class, but how can I obtain the native version ? I know RXTX prints to the console a warning if the version is different. Is there a way to programatically know is this is the case ? I would like to log that to our app's log thanks Ricardo From taj at www.linux.org.uk Wed Apr 6 15:10:20 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 6 Apr 2005 22:10:20 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4253F346.50102@emation.pt> References: <4253F346.50102@emation.pt> Message-ID: On Wed, 6 Apr 2005, Ricardo Trindade wrote: > Hi, > > I want to make sure my deployments have the same version of RXTX jar > and native lib. > > I know the version of the jar can be obtained in the Version class, > but how can I obtain the native version ? > > I know RXTX prints to the console a warning if the version is > different. Is there a way to programatically know is this is the case ? > > I would like to log that to our app's log > There isn't a suggested way of doing that right now. We could move things around and have a static String RXTXVersion.getNativeVersion() in future releases. Is this what you expected? This is not documented in commapi at all. I just tossed that in to catch conflicts while developing. It would be nice to have access in GUI applications though. It may be possible to access RXTXCommDriver.LibVersion right now. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Thu Apr 7 02:51:00 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 09:51:00 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> Message-ID: <4254F474.7020905@emation.pt> >There isn't a suggested way of doing that right now. We could move things >around and have a static String RXTXVersion.getNativeVersion() in future >releases. Is this what you expected? > > Yes, that would be perfect. >This is not documented in commapi at all. I just tossed that in to catch >conflicts while developing. It would be nice to have access in GUI >applications though. > >It may be possible to access RXTXCommDriver.LibVersion right now. > > > I tried, and I don't think it's possible. From taj at www.linux.org.uk Thu Apr 7 03:32:04 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 7 Apr 2005 10:32:04 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4254F474.7020905@emation.pt> References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: On Thu, 7 Apr 2005, Ricardo Trindade wrote: > > >There isn't a suggested way of doing that right now. We could move things > >around and have a static String RXTXVersion.getNativeVersion() in future > >releases. Is this what you expected? > > > > > > Yes, that would be perfect. > The attached should do what you want. You will still need to catch an exception for older versions... -- Trent Jarvi taj at www.linux.org.uk -------------- next part -------------- ? public_version.patch Index: RXTXCommDriver.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXCommDriver.java,v retrieving revision 1.16.2.51 diff -u -r1.16.2.51 RXTXCommDriver.java --- RXTXCommDriver.java 12 Oct 2004 09:13:30 -0000 1.16.2.51 +++ RXTXCommDriver.java 7 Apr 2005 09:29:04 -0000 @@ -54,7 +54,7 @@ the Library. */ String JarVersion = RXTXVersion.getVersion(); - String LibVersion = nativeGetVersion(); + String LibVersion = RXTXVersion.nativeGetVersion(); if ( devel ) { System.out.println("Devel Library"); @@ -76,7 +76,6 @@ /** Get the Serial port prefixes for the running OS */ private String deviceDirectory; private String osName; - private static native String nativeGetVersion(); private native boolean registerKnownPorts(int PortType); private native boolean isPortPrefixValid(String dev); private native boolean testRead(String dev, int type); Index: RXTXVersion.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXVersion.java,v retrieving revision 1.2.2.31 diff -u -r1.2.2.31 RXTXVersion.java --- RXTXVersion.java 16 Oct 2004 16:20:35 -0000 1.2.2.31 +++ RXTXVersion.java 7 Apr 2005 09:29:04 -0000 @@ -36,6 +36,7 @@ private static String Version; static { + System.loadLibrary( "rxtxSerial" ); Version = "RXTX-2.1-7pre20"; } /** @@ -47,4 +48,5 @@ { return(Version); } + public static native String nativeGetVersion(); } Index: SerialImp.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v retrieving revision 1.46.2.181 diff -u -r1.46.2.181 SerialImp.c --- SerialImp.c 17 Oct 2004 09:48:56 -0000 1.46.2.181 +++ SerialImp.c 7 Apr 2005 09:29:07 -0000 @@ -116,6 +116,7 @@ * It will eventually be removed. * */ #define RXTXPort(foo) Java_gnu_io_RXTXPort_ ## foo +#define RXTXVersion(foo) Java_gnu_io_RXTXVersion_ ## foo #define RXTXCommDriver(foo) Java_gnu_io_RXTXCommDriver_ ## foo #if defined(__sun__) || defined(__hpux__) @@ -4001,7 +4002,7 @@ } /*---------------------------------------------------------- -RXTXCommDriver.nativeGetVersion +RXTXVersion.nativeGetVersion accept: none perform: return the current version @@ -4010,9 +4011,10 @@ comments: This is used to avoid mixing versions of the .jar and native library. First introduced in rxtx-1.5-9 + Moved from RXTXCommDriver to RXTXVersion in rxtx-2.1-7 ----------------------------------------------------------*/ -JNIEXPORT jstring JNICALL RXTXCommDriver(nativeGetVersion) (JNIEnv *env, +JNIEXPORT jstring JNICALL RXTXVersion(nativeGetVersion) (JNIEnv *env, jclass jclazz ) { return (*env)->NewStringUTF( env, "RXTX-2.1-7pre20" ); From ricardo.trindade at emation.pt Thu Apr 7 03:45:58 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 10:45:58 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: <42550156.2040908@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050407/05212451/attachment-0144.html From thomas.shulok at lmco.com Thu Apr 7 17:43:11 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Thu, 07 Apr 2005 19:43:11 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi There, I'm attempting to talk RS232 between an embedded Linux box and a Windows box. Everything connects up fine, and I can send and receive a simple sequence of bytes with no problems. However, if around 5 seconds goes by without me sending something, I get the following when I attempt to send. java.io.IOException: Input/output error in writeArray Stack trace: java/lang/Throwable.()V java/lang/Throwable.(Ljava/lang/String;)V java/io/IOException.(Ljava/lang/String;)V gnu/io/RXTXPort.writeArray([BIIZ)V gnu/io/RXTXPort$SerialOutputStream.write([B)V SerialTest.main([Ljava/lang/String;)V If there interval is shorter (say 2 seconds between sends), I have no problems. On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and librxtxSerial-2.0.7pre2.so. Any ideas? Thanks, Thom -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5b23dcf/attachment-0144.html From taj at www.linux.org.uk Thu Apr 7 19:22:36 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:22:36 +0100 (BST) Subject: [Rxtx] Input/output error in writeArray In-Reply-To: References: Message-ID: On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a Windows > box. Everything connects up fine, and I can send and receive a simple > sequence of bytes with no problems. However, if around 5 seconds goes > by without me sending something, I get the following when I attempt to > send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Apr 7 19:24:59 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:24:59 +0100 (BST) Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) Message-ID: hmm. This would not work from applets would it? -- Trent Jarvi taj at www.linux.org.uk ---------- Forwarded message ---------- Date: Thu, 07 Apr 2005 16:05:53 -0400 From: Chris Gaffney To: taj at www.linux.org.uk Subject: RXTX Libraries on Classpath fix Hi, I submitted a patch for RXTX a few weeks ago to allow for loading the native libraries from the classpath. Since sending it to you I found it wasn't working on windows. I've fixed the problem and created a new patch that should replace the older one. The actual change is a one line from a String.equals() to a String.startsWith(). Thanks for a great piece of software, -Chris Gaffney Grand Valley State University -------------- next part -------------- A non-text attachment was scrubbed... Name: libraries_on_classpath_fixed.patch Type: text/x-patch Size: 5617 bytes Desc: Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5d423b8/libraries_on_classpath_fixed-0144.bin From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From thomas.shulok at lmco.com Fri Apr 8 10:38:55 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Fri, 08 Apr 2005 12:38:55 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi Trent, Thanks for the prompt response. Before diving deeper, I was wondering if there is a timeout parameter somewhere in the stack that I have not set properly. Given the nature of the failure (only fails if the line has been idle for a few seconds), it feels like some kind of timeout issue... Thanks again, Thom -----Original Message----- From: rxtx-bounces at mail.linuxgrrls.org [mailto:rxtx-bounces at mail.linuxgrrls.org] On Behalf Of Trent Jarvi Sent: Thursday, April 07, 2005 6:23 PM To: Java RXTX discussion Subject: Re: [Rxtx] Input/output error in writeArray On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a > Windows box. Everything connects up fine, and I can send and receive > a simple sequence of bytes with no problems. However, if around 5 > seconds goes by without me sending something, I get the following when > I attempt to send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at mail.linuxgrrls.org http://mail.linuxgrrls.org/mailman/listinfo/rxtx From ricardo.trindade at emation.pt Mon Apr 4 09:17:23 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Mon, 04 Apr 2005 16:17:23 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot Message-ID: <42515A83.4050907@emation.pt> Hi, I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most recent stable snapshot), and get the following exception : It looks like rxtx has been compiled with jdk 1.5. If this was indeed the case, I think there is a compilation flag that generates code that runs on older jdks. java.lang.UnsupportedClassVersionError: gnu/io/UnsupportedCommOperationException (Unsupported major.minor version 49.0) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at java.net.URLClassLoader.defineClass(URLClassLoader.java:251) at java.net.URLClassLoader.access$100(URLClassLoader.java:55) at java.net.URLClassLoader$1.run(URLClassLoader.java:194) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:187) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:141) I'm trying to run it with 1.4. thanks Ricardo From taj at www.linux.org.uk Tue Apr 5 00:48:12 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 07:48:12 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42515A83.4050907@emation.pt> References: <42515A83.4050907@emation.pt> Message-ID: On Mon, 4 Apr 2005, Ricardo Trindade wrote: > Hi, > > I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most > recent stable snapshot), and get the following exception : > > It looks like rxtx has been compiled with jdk 1.5. If this was > indeed the case, I think there is a compilation flag that generates code > that runs on older jdks. > > java.lang.UnsupportedClassVersionError: > gnu/io/UnsupportedCommOperationException (Unsupported major.minor > version 49.0) [snip] Thanks Ricardo I recompiled the jar with javac -source 1.3 -target 1.3. That should cover most of the JRE's in use today. I also compiled the rxtx 2.0 x86_64 native library which appeared to be missing. I tried looking for flags to pass gcc 4.0 to make the native libraries more backwards compatible but only found options for C++ which is not used in rxtx. I've got a list of other bugs that I'll be going through in the next few weeks but for now I just left them with the same CVS filename - no code changes. ftp://ftp.qbang.org/pub/rxtx/rxtx-2.0-CVS-20050120-bins.tar.gz ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-CVS-20050120-bins.tar.gz -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Tue Apr 5 02:24:33 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 05 Apr 2005 09:24:33 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: References: <42515A83.4050907@emation.pt> Message-ID: <42524B41.3040300@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050405/5919abbb/attachment-0145.html From taj at www.linux.org.uk Tue Apr 5 03:00:29 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 10:00:29 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42524B41.3040300@emation.pt> References: <42515A83.4050907@emation.pt> <42524B41.3040300@emation.pt> Message-ID: On Tue, 5 Apr 2005, Ricardo Trindade wrote: > Will you anounce to the list when a new release is available ? > There will be several incremental releases announced here. Once those are done, we will release 2.1.7 and 2.0.7. -- Trent Jarvi taj at www.linux.org.uk From no_spam at somewhere.com Tue Apr 5 11:55:37 2005 From: no_spam at somewhere.com (no_spam@somewhere.com) Date: Tue, 5 Apr 2005 13:55:37 -0400 Subject: [Rxtx] Closing a port from an event listener results in a deadlock Message-ID: <20050405175537.GA21747@rcog.homelinux.net> On the message I sent on March 14, does anyone had the chance to try the modification? Or was it already fixed? (I haven't searched the archive extensively) Or maybe my message got catched by some spam filters? (it made it to the list archive though) Anyway, I would appreciate some feedback (through the list) Thanks From taj at www.linux.org.uk Tue Apr 5 14:42:28 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 21:42:28 +0100 (BST) Subject: [Rxtx] Closing a port from an event listener results in a deadlock In-Reply-To: <20050405175537.GA21747@rcog.homelinux.net> References: <20050405175537.GA21747@rcog.homelinux.net> Message-ID: On Tue, 5 Apr 2005 no_spam at somewhere.com wrote: > On the message I sent on March 14, does anyone had the chance to try the > modification? > > Or was it already fixed? (I haven't searched the archive extensively) > > Or maybe my message got catched by some spam filters? (it made it to the list > archive though) > > Anyway, I would appreciate some feedback (through the list) > The patch is here http://marc.theaimsgroup.com/?l=rxtx&m=111084488820288&w=2 I have applied this patch to a local copy but will not be doing formal testing for a couple weeks. I do not try to close ports from inside the eventListenter usually so I encourage any feedback also. If there are no problems reported, I expect this will go into rxtx 2.1-7. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Wed Apr 6 08:33:42 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Wed, 06 Apr 2005 15:33:42 +0100 Subject: [Rxtx] getting RXTX version Message-ID: <4253F346.50102@emation.pt> Hi, I want to make sure my deployments have the same version of RXTX jar and native lib. I know the version of the jar can be obtained in the Version class, but how can I obtain the native version ? I know RXTX prints to the console a warning if the version is different. Is there a way to programatically know is this is the case ? I would like to log that to our app's log thanks Ricardo From taj at www.linux.org.uk Wed Apr 6 15:10:20 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 6 Apr 2005 22:10:20 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4253F346.50102@emation.pt> References: <4253F346.50102@emation.pt> Message-ID: On Wed, 6 Apr 2005, Ricardo Trindade wrote: > Hi, > > I want to make sure my deployments have the same version of RXTX jar > and native lib. > > I know the version of the jar can be obtained in the Version class, > but how can I obtain the native version ? > > I know RXTX prints to the console a warning if the version is > different. Is there a way to programatically know is this is the case ? > > I would like to log that to our app's log > There isn't a suggested way of doing that right now. We could move things around and have a static String RXTXVersion.getNativeVersion() in future releases. Is this what you expected? This is not documented in commapi at all. I just tossed that in to catch conflicts while developing. It would be nice to have access in GUI applications though. It may be possible to access RXTXCommDriver.LibVersion right now. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Thu Apr 7 02:51:00 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 09:51:00 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> Message-ID: <4254F474.7020905@emation.pt> >There isn't a suggested way of doing that right now. We could move things >around and have a static String RXTXVersion.getNativeVersion() in future >releases. Is this what you expected? > > Yes, that would be perfect. >This is not documented in commapi at all. I just tossed that in to catch >conflicts while developing. It would be nice to have access in GUI >applications though. > >It may be possible to access RXTXCommDriver.LibVersion right now. > > > I tried, and I don't think it's possible. From taj at www.linux.org.uk Thu Apr 7 03:32:04 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 7 Apr 2005 10:32:04 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4254F474.7020905@emation.pt> References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: On Thu, 7 Apr 2005, Ricardo Trindade wrote: > > >There isn't a suggested way of doing that right now. We could move things > >around and have a static String RXTXVersion.getNativeVersion() in future > >releases. Is this what you expected? > > > > > > Yes, that would be perfect. > The attached should do what you want. You will still need to catch an exception for older versions... -- Trent Jarvi taj at www.linux.org.uk -------------- next part -------------- ? public_version.patch Index: RXTXCommDriver.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXCommDriver.java,v retrieving revision 1.16.2.51 diff -u -r1.16.2.51 RXTXCommDriver.java --- RXTXCommDriver.java 12 Oct 2004 09:13:30 -0000 1.16.2.51 +++ RXTXCommDriver.java 7 Apr 2005 09:29:04 -0000 @@ -54,7 +54,7 @@ the Library. */ String JarVersion = RXTXVersion.getVersion(); - String LibVersion = nativeGetVersion(); + String LibVersion = RXTXVersion.nativeGetVersion(); if ( devel ) { System.out.println("Devel Library"); @@ -76,7 +76,6 @@ /** Get the Serial port prefixes for the running OS */ private String deviceDirectory; private String osName; - private static native String nativeGetVersion(); private native boolean registerKnownPorts(int PortType); private native boolean isPortPrefixValid(String dev); private native boolean testRead(String dev, int type); Index: RXTXVersion.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXVersion.java,v retrieving revision 1.2.2.31 diff -u -r1.2.2.31 RXTXVersion.java --- RXTXVersion.java 16 Oct 2004 16:20:35 -0000 1.2.2.31 +++ RXTXVersion.java 7 Apr 2005 09:29:04 -0000 @@ -36,6 +36,7 @@ private static String Version; static { + System.loadLibrary( "rxtxSerial" ); Version = "RXTX-2.1-7pre20"; } /** @@ -47,4 +48,5 @@ { return(Version); } + public static native String nativeGetVersion(); } Index: SerialImp.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v retrieving revision 1.46.2.181 diff -u -r1.46.2.181 SerialImp.c --- SerialImp.c 17 Oct 2004 09:48:56 -0000 1.46.2.181 +++ SerialImp.c 7 Apr 2005 09:29:07 -0000 @@ -116,6 +116,7 @@ * It will eventually be removed. * */ #define RXTXPort(foo) Java_gnu_io_RXTXPort_ ## foo +#define RXTXVersion(foo) Java_gnu_io_RXTXVersion_ ## foo #define RXTXCommDriver(foo) Java_gnu_io_RXTXCommDriver_ ## foo #if defined(__sun__) || defined(__hpux__) @@ -4001,7 +4002,7 @@ } /*---------------------------------------------------------- -RXTXCommDriver.nativeGetVersion +RXTXVersion.nativeGetVersion accept: none perform: return the current version @@ -4010,9 +4011,10 @@ comments: This is used to avoid mixing versions of the .jar and native library. First introduced in rxtx-1.5-9 + Moved from RXTXCommDriver to RXTXVersion in rxtx-2.1-7 ----------------------------------------------------------*/ -JNIEXPORT jstring JNICALL RXTXCommDriver(nativeGetVersion) (JNIEnv *env, +JNIEXPORT jstring JNICALL RXTXVersion(nativeGetVersion) (JNIEnv *env, jclass jclazz ) { return (*env)->NewStringUTF( env, "RXTX-2.1-7pre20" ); From ricardo.trindade at emation.pt Thu Apr 7 03:45:58 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 10:45:58 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: <42550156.2040908@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050407/05212451/attachment-0145.html From thomas.shulok at lmco.com Thu Apr 7 17:43:11 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Thu, 07 Apr 2005 19:43:11 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi There, I'm attempting to talk RS232 between an embedded Linux box and a Windows box. Everything connects up fine, and I can send and receive a simple sequence of bytes with no problems. However, if around 5 seconds goes by without me sending something, I get the following when I attempt to send. java.io.IOException: Input/output error in writeArray Stack trace: java/lang/Throwable.()V java/lang/Throwable.(Ljava/lang/String;)V java/io/IOException.(Ljava/lang/String;)V gnu/io/RXTXPort.writeArray([BIIZ)V gnu/io/RXTXPort$SerialOutputStream.write([B)V SerialTest.main([Ljava/lang/String;)V If there interval is shorter (say 2 seconds between sends), I have no problems. On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and librxtxSerial-2.0.7pre2.so. Any ideas? Thanks, Thom -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5b23dcf/attachment-0145.html From taj at www.linux.org.uk Thu Apr 7 19:22:36 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:22:36 +0100 (BST) Subject: [Rxtx] Input/output error in writeArray In-Reply-To: References: Message-ID: On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a Windows > box. Everything connects up fine, and I can send and receive a simple > sequence of bytes with no problems. However, if around 5 seconds goes > by without me sending something, I get the following when I attempt to > send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Apr 7 19:24:59 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:24:59 +0100 (BST) Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) Message-ID: hmm. This would not work from applets would it? -- Trent Jarvi taj at www.linux.org.uk ---------- Forwarded message ---------- Date: Thu, 07 Apr 2005 16:05:53 -0400 From: Chris Gaffney To: taj at www.linux.org.uk Subject: RXTX Libraries on Classpath fix Hi, I submitted a patch for RXTX a few weeks ago to allow for loading the native libraries from the classpath. Since sending it to you I found it wasn't working on windows. I've fixed the problem and created a new patch that should replace the older one. The actual change is a one line from a String.equals() to a String.startsWith(). Thanks for a great piece of software, -Chris Gaffney Grand Valley State University -------------- next part -------------- A non-text attachment was scrubbed... Name: libraries_on_classpath_fixed.patch Type: text/x-patch Size: 5617 bytes Desc: Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5d423b8/libraries_on_classpath_fixed-0145.bin From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From thomas.shulok at lmco.com Fri Apr 8 10:38:55 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Fri, 08 Apr 2005 12:38:55 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi Trent, Thanks for the prompt response. Before diving deeper, I was wondering if there is a timeout parameter somewhere in the stack that I have not set properly. Given the nature of the failure (only fails if the line has been idle for a few seconds), it feels like some kind of timeout issue... Thanks again, Thom -----Original Message----- From: rxtx-bounces at mail.linuxgrrls.org [mailto:rxtx-bounces at mail.linuxgrrls.org] On Behalf Of Trent Jarvi Sent: Thursday, April 07, 2005 6:23 PM To: Java RXTX discussion Subject: Re: [Rxtx] Input/output error in writeArray On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a > Windows box. Everything connects up fine, and I can send and receive > a simple sequence of bytes with no problems. However, if around 5 > seconds goes by without me sending something, I get the following when > I attempt to send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at mail.linuxgrrls.org http://mail.linuxgrrls.org/mailman/listinfo/rxtx From ricardo.trindade at emation.pt Mon Apr 4 09:17:23 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Mon, 04 Apr 2005 16:17:23 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot Message-ID: <42515A83.4050907@emation.pt> Hi, I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most recent stable snapshot), and get the following exception : It looks like rxtx has been compiled with jdk 1.5. If this was indeed the case, I think there is a compilation flag that generates code that runs on older jdks. java.lang.UnsupportedClassVersionError: gnu/io/UnsupportedCommOperationException (Unsupported major.minor version 49.0) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at java.net.URLClassLoader.defineClass(URLClassLoader.java:251) at java.net.URLClassLoader.access$100(URLClassLoader.java:55) at java.net.URLClassLoader$1.run(URLClassLoader.java:194) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:187) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:141) I'm trying to run it with 1.4. thanks Ricardo From taj at www.linux.org.uk Tue Apr 5 00:48:12 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 07:48:12 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42515A83.4050907@emation.pt> References: <42515A83.4050907@emation.pt> Message-ID: On Mon, 4 Apr 2005, Ricardo Trindade wrote: > Hi, > > I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most > recent stable snapshot), and get the following exception : > > It looks like rxtx has been compiled with jdk 1.5. If this was > indeed the case, I think there is a compilation flag that generates code > that runs on older jdks. > > java.lang.UnsupportedClassVersionError: > gnu/io/UnsupportedCommOperationException (Unsupported major.minor > version 49.0) [snip] Thanks Ricardo I recompiled the jar with javac -source 1.3 -target 1.3. That should cover most of the JRE's in use today. I also compiled the rxtx 2.0 x86_64 native library which appeared to be missing. I tried looking for flags to pass gcc 4.0 to make the native libraries more backwards compatible but only found options for C++ which is not used in rxtx. I've got a list of other bugs that I'll be going through in the next few weeks but for now I just left them with the same CVS filename - no code changes. ftp://ftp.qbang.org/pub/rxtx/rxtx-2.0-CVS-20050120-bins.tar.gz ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-CVS-20050120-bins.tar.gz -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Tue Apr 5 02:24:33 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 05 Apr 2005 09:24:33 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: References: <42515A83.4050907@emation.pt> Message-ID: <42524B41.3040300@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050405/5919abbb/attachment-0146.html From taj at www.linux.org.uk Tue Apr 5 03:00:29 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 10:00:29 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42524B41.3040300@emation.pt> References: <42515A83.4050907@emation.pt> <42524B41.3040300@emation.pt> Message-ID: On Tue, 5 Apr 2005, Ricardo Trindade wrote: > Will you anounce to the list when a new release is available ? > There will be several incremental releases announced here. Once those are done, we will release 2.1.7 and 2.0.7. -- Trent Jarvi taj at www.linux.org.uk From no_spam at somewhere.com Tue Apr 5 11:55:37 2005 From: no_spam at somewhere.com (no_spam@somewhere.com) Date: Tue, 5 Apr 2005 13:55:37 -0400 Subject: [Rxtx] Closing a port from an event listener results in a deadlock Message-ID: <20050405175537.GA21747@rcog.homelinux.net> On the message I sent on March 14, does anyone had the chance to try the modification? Or was it already fixed? (I haven't searched the archive extensively) Or maybe my message got catched by some spam filters? (it made it to the list archive though) Anyway, I would appreciate some feedback (through the list) Thanks From taj at www.linux.org.uk Tue Apr 5 14:42:28 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 21:42:28 +0100 (BST) Subject: [Rxtx] Closing a port from an event listener results in a deadlock In-Reply-To: <20050405175537.GA21747@rcog.homelinux.net> References: <20050405175537.GA21747@rcog.homelinux.net> Message-ID: On Tue, 5 Apr 2005 no_spam at somewhere.com wrote: > On the message I sent on March 14, does anyone had the chance to try the > modification? > > Or was it already fixed? (I haven't searched the archive extensively) > > Or maybe my message got catched by some spam filters? (it made it to the list > archive though) > > Anyway, I would appreciate some feedback (through the list) > The patch is here http://marc.theaimsgroup.com/?l=rxtx&m=111084488820288&w=2 I have applied this patch to a local copy but will not be doing formal testing for a couple weeks. I do not try to close ports from inside the eventListenter usually so I encourage any feedback also. If there are no problems reported, I expect this will go into rxtx 2.1-7. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Wed Apr 6 08:33:42 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Wed, 06 Apr 2005 15:33:42 +0100 Subject: [Rxtx] getting RXTX version Message-ID: <4253F346.50102@emation.pt> Hi, I want to make sure my deployments have the same version of RXTX jar and native lib. I know the version of the jar can be obtained in the Version class, but how can I obtain the native version ? I know RXTX prints to the console a warning if the version is different. Is there a way to programatically know is this is the case ? I would like to log that to our app's log thanks Ricardo From taj at www.linux.org.uk Wed Apr 6 15:10:20 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 6 Apr 2005 22:10:20 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4253F346.50102@emation.pt> References: <4253F346.50102@emation.pt> Message-ID: On Wed, 6 Apr 2005, Ricardo Trindade wrote: > Hi, > > I want to make sure my deployments have the same version of RXTX jar > and native lib. > > I know the version of the jar can be obtained in the Version class, > but how can I obtain the native version ? > > I know RXTX prints to the console a warning if the version is > different. Is there a way to programatically know is this is the case ? > > I would like to log that to our app's log > There isn't a suggested way of doing that right now. We could move things around and have a static String RXTXVersion.getNativeVersion() in future releases. Is this what you expected? This is not documented in commapi at all. I just tossed that in to catch conflicts while developing. It would be nice to have access in GUI applications though. It may be possible to access RXTXCommDriver.LibVersion right now. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Thu Apr 7 02:51:00 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 09:51:00 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> Message-ID: <4254F474.7020905@emation.pt> >There isn't a suggested way of doing that right now. We could move things >around and have a static String RXTXVersion.getNativeVersion() in future >releases. Is this what you expected? > > Yes, that would be perfect. >This is not documented in commapi at all. I just tossed that in to catch >conflicts while developing. It would be nice to have access in GUI >applications though. > >It may be possible to access RXTXCommDriver.LibVersion right now. > > > I tried, and I don't think it's possible. From taj at www.linux.org.uk Thu Apr 7 03:32:04 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 7 Apr 2005 10:32:04 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4254F474.7020905@emation.pt> References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: On Thu, 7 Apr 2005, Ricardo Trindade wrote: > > >There isn't a suggested way of doing that right now. We could move things > >around and have a static String RXTXVersion.getNativeVersion() in future > >releases. Is this what you expected? > > > > > > Yes, that would be perfect. > The attached should do what you want. You will still need to catch an exception for older versions... -- Trent Jarvi taj at www.linux.org.uk -------------- next part -------------- ? public_version.patch Index: RXTXCommDriver.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXCommDriver.java,v retrieving revision 1.16.2.51 diff -u -r1.16.2.51 RXTXCommDriver.java --- RXTXCommDriver.java 12 Oct 2004 09:13:30 -0000 1.16.2.51 +++ RXTXCommDriver.java 7 Apr 2005 09:29:04 -0000 @@ -54,7 +54,7 @@ the Library. */ String JarVersion = RXTXVersion.getVersion(); - String LibVersion = nativeGetVersion(); + String LibVersion = RXTXVersion.nativeGetVersion(); if ( devel ) { System.out.println("Devel Library"); @@ -76,7 +76,6 @@ /** Get the Serial port prefixes for the running OS */ private String deviceDirectory; private String osName; - private static native String nativeGetVersion(); private native boolean registerKnownPorts(int PortType); private native boolean isPortPrefixValid(String dev); private native boolean testRead(String dev, int type); Index: RXTXVersion.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXVersion.java,v retrieving revision 1.2.2.31 diff -u -r1.2.2.31 RXTXVersion.java --- RXTXVersion.java 16 Oct 2004 16:20:35 -0000 1.2.2.31 +++ RXTXVersion.java 7 Apr 2005 09:29:04 -0000 @@ -36,6 +36,7 @@ private static String Version; static { + System.loadLibrary( "rxtxSerial" ); Version = "RXTX-2.1-7pre20"; } /** @@ -47,4 +48,5 @@ { return(Version); } + public static native String nativeGetVersion(); } Index: SerialImp.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v retrieving revision 1.46.2.181 diff -u -r1.46.2.181 SerialImp.c --- SerialImp.c 17 Oct 2004 09:48:56 -0000 1.46.2.181 +++ SerialImp.c 7 Apr 2005 09:29:07 -0000 @@ -116,6 +116,7 @@ * It will eventually be removed. * */ #define RXTXPort(foo) Java_gnu_io_RXTXPort_ ## foo +#define RXTXVersion(foo) Java_gnu_io_RXTXVersion_ ## foo #define RXTXCommDriver(foo) Java_gnu_io_RXTXCommDriver_ ## foo #if defined(__sun__) || defined(__hpux__) @@ -4001,7 +4002,7 @@ } /*---------------------------------------------------------- -RXTXCommDriver.nativeGetVersion +RXTXVersion.nativeGetVersion accept: none perform: return the current version @@ -4010,9 +4011,10 @@ comments: This is used to avoid mixing versions of the .jar and native library. First introduced in rxtx-1.5-9 + Moved from RXTXCommDriver to RXTXVersion in rxtx-2.1-7 ----------------------------------------------------------*/ -JNIEXPORT jstring JNICALL RXTXCommDriver(nativeGetVersion) (JNIEnv *env, +JNIEXPORT jstring JNICALL RXTXVersion(nativeGetVersion) (JNIEnv *env, jclass jclazz ) { return (*env)->NewStringUTF( env, "RXTX-2.1-7pre20" ); From ricardo.trindade at emation.pt Thu Apr 7 03:45:58 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 10:45:58 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: <42550156.2040908@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050407/05212451/attachment-0146.html From thomas.shulok at lmco.com Thu Apr 7 17:43:11 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Thu, 07 Apr 2005 19:43:11 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi There, I'm attempting to talk RS232 between an embedded Linux box and a Windows box. Everything connects up fine, and I can send and receive a simple sequence of bytes with no problems. However, if around 5 seconds goes by without me sending something, I get the following when I attempt to send. java.io.IOException: Input/output error in writeArray Stack trace: java/lang/Throwable.()V java/lang/Throwable.(Ljava/lang/String;)V java/io/IOException.(Ljava/lang/String;)V gnu/io/RXTXPort.writeArray([BIIZ)V gnu/io/RXTXPort$SerialOutputStream.write([B)V SerialTest.main([Ljava/lang/String;)V If there interval is shorter (say 2 seconds between sends), I have no problems. On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and librxtxSerial-2.0.7pre2.so. Any ideas? Thanks, Thom -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5b23dcf/attachment-0146.html From taj at www.linux.org.uk Thu Apr 7 19:22:36 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:22:36 +0100 (BST) Subject: [Rxtx] Input/output error in writeArray In-Reply-To: References: Message-ID: On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a Windows > box. Everything connects up fine, and I can send and receive a simple > sequence of bytes with no problems. However, if around 5 seconds goes > by without me sending something, I get the following when I attempt to > send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Apr 7 19:24:59 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:24:59 +0100 (BST) Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) Message-ID: hmm. This would not work from applets would it? -- Trent Jarvi taj at www.linux.org.uk ---------- Forwarded message ---------- Date: Thu, 07 Apr 2005 16:05:53 -0400 From: Chris Gaffney To: taj at www.linux.org.uk Subject: RXTX Libraries on Classpath fix Hi, I submitted a patch for RXTX a few weeks ago to allow for loading the native libraries from the classpath. Since sending it to you I found it wasn't working on windows. I've fixed the problem and created a new patch that should replace the older one. The actual change is a one line from a String.equals() to a String.startsWith(). Thanks for a great piece of software, -Chris Gaffney Grand Valley State University -------------- next part -------------- A non-text attachment was scrubbed... Name: libraries_on_classpath_fixed.patch Type: text/x-patch Size: 5617 bytes Desc: Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5d423b8/libraries_on_classpath_fixed-0146.bin From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From thomas.shulok at lmco.com Fri Apr 8 10:38:55 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Fri, 08 Apr 2005 12:38:55 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi Trent, Thanks for the prompt response. Before diving deeper, I was wondering if there is a timeout parameter somewhere in the stack that I have not set properly. Given the nature of the failure (only fails if the line has been idle for a few seconds), it feels like some kind of timeout issue... Thanks again, Thom -----Original Message----- From: rxtx-bounces at mail.linuxgrrls.org [mailto:rxtx-bounces at mail.linuxgrrls.org] On Behalf Of Trent Jarvi Sent: Thursday, April 07, 2005 6:23 PM To: Java RXTX discussion Subject: Re: [Rxtx] Input/output error in writeArray On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a > Windows box. Everything connects up fine, and I can send and receive > a simple sequence of bytes with no problems. However, if around 5 > seconds goes by without me sending something, I get the following when > I attempt to send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at mail.linuxgrrls.org http://mail.linuxgrrls.org/mailman/listinfo/rxtx From ricardo.trindade at emation.pt Mon Apr 4 09:17:23 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Mon, 04 Apr 2005 16:17:23 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot Message-ID: <42515A83.4050907@emation.pt> Hi, I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most recent stable snapshot), and get the following exception : It looks like rxtx has been compiled with jdk 1.5. If this was indeed the case, I think there is a compilation flag that generates code that runs on older jdks. java.lang.UnsupportedClassVersionError: gnu/io/UnsupportedCommOperationException (Unsupported major.minor version 49.0) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at java.net.URLClassLoader.defineClass(URLClassLoader.java:251) at java.net.URLClassLoader.access$100(URLClassLoader.java:55) at java.net.URLClassLoader$1.run(URLClassLoader.java:194) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:187) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:141) I'm trying to run it with 1.4. thanks Ricardo From taj at www.linux.org.uk Tue Apr 5 00:48:12 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 07:48:12 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42515A83.4050907@emation.pt> References: <42515A83.4050907@emation.pt> Message-ID: On Mon, 4 Apr 2005, Ricardo Trindade wrote: > Hi, > > I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most > recent stable snapshot), and get the following exception : > > It looks like rxtx has been compiled with jdk 1.5. If this was > indeed the case, I think there is a compilation flag that generates code > that runs on older jdks. > > java.lang.UnsupportedClassVersionError: > gnu/io/UnsupportedCommOperationException (Unsupported major.minor > version 49.0) [snip] Thanks Ricardo I recompiled the jar with javac -source 1.3 -target 1.3. That should cover most of the JRE's in use today. I also compiled the rxtx 2.0 x86_64 native library which appeared to be missing. I tried looking for flags to pass gcc 4.0 to make the native libraries more backwards compatible but only found options for C++ which is not used in rxtx. I've got a list of other bugs that I'll be going through in the next few weeks but for now I just left them with the same CVS filename - no code changes. ftp://ftp.qbang.org/pub/rxtx/rxtx-2.0-CVS-20050120-bins.tar.gz ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-CVS-20050120-bins.tar.gz -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Tue Apr 5 02:24:33 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 05 Apr 2005 09:24:33 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: References: <42515A83.4050907@emation.pt> Message-ID: <42524B41.3040300@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050405/5919abbb/attachment-0147.html From taj at www.linux.org.uk Tue Apr 5 03:00:29 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 10:00:29 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42524B41.3040300@emation.pt> References: <42515A83.4050907@emation.pt> <42524B41.3040300@emation.pt> Message-ID: On Tue, 5 Apr 2005, Ricardo Trindade wrote: > Will you anounce to the list when a new release is available ? > There will be several incremental releases announced here. Once those are done, we will release 2.1.7 and 2.0.7. -- Trent Jarvi taj at www.linux.org.uk From no_spam at somewhere.com Tue Apr 5 11:55:37 2005 From: no_spam at somewhere.com (no_spam@somewhere.com) Date: Tue, 5 Apr 2005 13:55:37 -0400 Subject: [Rxtx] Closing a port from an event listener results in a deadlock Message-ID: <20050405175537.GA21747@rcog.homelinux.net> On the message I sent on March 14, does anyone had the chance to try the modification? Or was it already fixed? (I haven't searched the archive extensively) Or maybe my message got catched by some spam filters? (it made it to the list archive though) Anyway, I would appreciate some feedback (through the list) Thanks From taj at www.linux.org.uk Tue Apr 5 14:42:28 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 21:42:28 +0100 (BST) Subject: [Rxtx] Closing a port from an event listener results in a deadlock In-Reply-To: <20050405175537.GA21747@rcog.homelinux.net> References: <20050405175537.GA21747@rcog.homelinux.net> Message-ID: On Tue, 5 Apr 2005 no_spam at somewhere.com wrote: > On the message I sent on March 14, does anyone had the chance to try the > modification? > > Or was it already fixed? (I haven't searched the archive extensively) > > Or maybe my message got catched by some spam filters? (it made it to the list > archive though) > > Anyway, I would appreciate some feedback (through the list) > The patch is here http://marc.theaimsgroup.com/?l=rxtx&m=111084488820288&w=2 I have applied this patch to a local copy but will not be doing formal testing for a couple weeks. I do not try to close ports from inside the eventListenter usually so I encourage any feedback also. If there are no problems reported, I expect this will go into rxtx 2.1-7. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Wed Apr 6 08:33:42 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Wed, 06 Apr 2005 15:33:42 +0100 Subject: [Rxtx] getting RXTX version Message-ID: <4253F346.50102@emation.pt> Hi, I want to make sure my deployments have the same version of RXTX jar and native lib. I know the version of the jar can be obtained in the Version class, but how can I obtain the native version ? I know RXTX prints to the console a warning if the version is different. Is there a way to programatically know is this is the case ? I would like to log that to our app's log thanks Ricardo From taj at www.linux.org.uk Wed Apr 6 15:10:20 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 6 Apr 2005 22:10:20 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4253F346.50102@emation.pt> References: <4253F346.50102@emation.pt> Message-ID: On Wed, 6 Apr 2005, Ricardo Trindade wrote: > Hi, > > I want to make sure my deployments have the same version of RXTX jar > and native lib. > > I know the version of the jar can be obtained in the Version class, > but how can I obtain the native version ? > > I know RXTX prints to the console a warning if the version is > different. Is there a way to programatically know is this is the case ? > > I would like to log that to our app's log > There isn't a suggested way of doing that right now. We could move things around and have a static String RXTXVersion.getNativeVersion() in future releases. Is this what you expected? This is not documented in commapi at all. I just tossed that in to catch conflicts while developing. It would be nice to have access in GUI applications though. It may be possible to access RXTXCommDriver.LibVersion right now. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Thu Apr 7 02:51:00 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 09:51:00 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> Message-ID: <4254F474.7020905@emation.pt> >There isn't a suggested way of doing that right now. We could move things >around and have a static String RXTXVersion.getNativeVersion() in future >releases. Is this what you expected? > > Yes, that would be perfect. >This is not documented in commapi at all. I just tossed that in to catch >conflicts while developing. It would be nice to have access in GUI >applications though. > >It may be possible to access RXTXCommDriver.LibVersion right now. > > > I tried, and I don't think it's possible. From taj at www.linux.org.uk Thu Apr 7 03:32:04 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 7 Apr 2005 10:32:04 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4254F474.7020905@emation.pt> References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: On Thu, 7 Apr 2005, Ricardo Trindade wrote: > > >There isn't a suggested way of doing that right now. We could move things > >around and have a static String RXTXVersion.getNativeVersion() in future > >releases. Is this what you expected? > > > > > > Yes, that would be perfect. > The attached should do what you want. You will still need to catch an exception for older versions... -- Trent Jarvi taj at www.linux.org.uk -------------- next part -------------- ? public_version.patch Index: RXTXCommDriver.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXCommDriver.java,v retrieving revision 1.16.2.51 diff -u -r1.16.2.51 RXTXCommDriver.java --- RXTXCommDriver.java 12 Oct 2004 09:13:30 -0000 1.16.2.51 +++ RXTXCommDriver.java 7 Apr 2005 09:29:04 -0000 @@ -54,7 +54,7 @@ the Library. */ String JarVersion = RXTXVersion.getVersion(); - String LibVersion = nativeGetVersion(); + String LibVersion = RXTXVersion.nativeGetVersion(); if ( devel ) { System.out.println("Devel Library"); @@ -76,7 +76,6 @@ /** Get the Serial port prefixes for the running OS */ private String deviceDirectory; private String osName; - private static native String nativeGetVersion(); private native boolean registerKnownPorts(int PortType); private native boolean isPortPrefixValid(String dev); private native boolean testRead(String dev, int type); Index: RXTXVersion.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXVersion.java,v retrieving revision 1.2.2.31 diff -u -r1.2.2.31 RXTXVersion.java --- RXTXVersion.java 16 Oct 2004 16:20:35 -0000 1.2.2.31 +++ RXTXVersion.java 7 Apr 2005 09:29:04 -0000 @@ -36,6 +36,7 @@ private static String Version; static { + System.loadLibrary( "rxtxSerial" ); Version = "RXTX-2.1-7pre20"; } /** @@ -47,4 +48,5 @@ { return(Version); } + public static native String nativeGetVersion(); } Index: SerialImp.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v retrieving revision 1.46.2.181 diff -u -r1.46.2.181 SerialImp.c --- SerialImp.c 17 Oct 2004 09:48:56 -0000 1.46.2.181 +++ SerialImp.c 7 Apr 2005 09:29:07 -0000 @@ -116,6 +116,7 @@ * It will eventually be removed. * */ #define RXTXPort(foo) Java_gnu_io_RXTXPort_ ## foo +#define RXTXVersion(foo) Java_gnu_io_RXTXVersion_ ## foo #define RXTXCommDriver(foo) Java_gnu_io_RXTXCommDriver_ ## foo #if defined(__sun__) || defined(__hpux__) @@ -4001,7 +4002,7 @@ } /*---------------------------------------------------------- -RXTXCommDriver.nativeGetVersion +RXTXVersion.nativeGetVersion accept: none perform: return the current version @@ -4010,9 +4011,10 @@ comments: This is used to avoid mixing versions of the .jar and native library. First introduced in rxtx-1.5-9 + Moved from RXTXCommDriver to RXTXVersion in rxtx-2.1-7 ----------------------------------------------------------*/ -JNIEXPORT jstring JNICALL RXTXCommDriver(nativeGetVersion) (JNIEnv *env, +JNIEXPORT jstring JNICALL RXTXVersion(nativeGetVersion) (JNIEnv *env, jclass jclazz ) { return (*env)->NewStringUTF( env, "RXTX-2.1-7pre20" ); From ricardo.trindade at emation.pt Thu Apr 7 03:45:58 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 10:45:58 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: <42550156.2040908@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050407/05212451/attachment-0147.html From thomas.shulok at lmco.com Thu Apr 7 17:43:11 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Thu, 07 Apr 2005 19:43:11 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi There, I'm attempting to talk RS232 between an embedded Linux box and a Windows box. Everything connects up fine, and I can send and receive a simple sequence of bytes with no problems. However, if around 5 seconds goes by without me sending something, I get the following when I attempt to send. java.io.IOException: Input/output error in writeArray Stack trace: java/lang/Throwable.()V java/lang/Throwable.(Ljava/lang/String;)V java/io/IOException.(Ljava/lang/String;)V gnu/io/RXTXPort.writeArray([BIIZ)V gnu/io/RXTXPort$SerialOutputStream.write([B)V SerialTest.main([Ljava/lang/String;)V If there interval is shorter (say 2 seconds between sends), I have no problems. On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and librxtxSerial-2.0.7pre2.so. Any ideas? Thanks, Thom -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5b23dcf/attachment-0147.html From taj at www.linux.org.uk Thu Apr 7 19:22:36 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:22:36 +0100 (BST) Subject: [Rxtx] Input/output error in writeArray In-Reply-To: References: Message-ID: On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a Windows > box. Everything connects up fine, and I can send and receive a simple > sequence of bytes with no problems. However, if around 5 seconds goes > by without me sending something, I get the following when I attempt to > send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Apr 7 19:24:59 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:24:59 +0100 (BST) Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) Message-ID: hmm. This would not work from applets would it? -- Trent Jarvi taj at www.linux.org.uk ---------- Forwarded message ---------- Date: Thu, 07 Apr 2005 16:05:53 -0400 From: Chris Gaffney To: taj at www.linux.org.uk Subject: RXTX Libraries on Classpath fix Hi, I submitted a patch for RXTX a few weeks ago to allow for loading the native libraries from the classpath. Since sending it to you I found it wasn't working on windows. I've fixed the problem and created a new patch that should replace the older one. The actual change is a one line from a String.equals() to a String.startsWith(). Thanks for a great piece of software, -Chris Gaffney Grand Valley State University -------------- next part -------------- A non-text attachment was scrubbed... Name: libraries_on_classpath_fixed.patch Type: text/x-patch Size: 5617 bytes Desc: Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5d423b8/libraries_on_classpath_fixed-0147.bin From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From thomas.shulok at lmco.com Fri Apr 8 10:38:55 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Fri, 08 Apr 2005 12:38:55 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi Trent, Thanks for the prompt response. Before diving deeper, I was wondering if there is a timeout parameter somewhere in the stack that I have not set properly. Given the nature of the failure (only fails if the line has been idle for a few seconds), it feels like some kind of timeout issue... Thanks again, Thom -----Original Message----- From: rxtx-bounces at mail.linuxgrrls.org [mailto:rxtx-bounces at mail.linuxgrrls.org] On Behalf Of Trent Jarvi Sent: Thursday, April 07, 2005 6:23 PM To: Java RXTX discussion Subject: Re: [Rxtx] Input/output error in writeArray On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a > Windows box. Everything connects up fine, and I can send and receive > a simple sequence of bytes with no problems. However, if around 5 > seconds goes by without me sending something, I get the following when > I attempt to send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at mail.linuxgrrls.org http://mail.linuxgrrls.org/mailman/listinfo/rxtx From ricardo.trindade at emation.pt Mon Apr 4 09:17:23 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Mon, 04 Apr 2005 16:17:23 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot Message-ID: <42515A83.4050907@emation.pt> Hi, I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most recent stable snapshot), and get the following exception : It looks like rxtx has been compiled with jdk 1.5. If this was indeed the case, I think there is a compilation flag that generates code that runs on older jdks. java.lang.UnsupportedClassVersionError: gnu/io/UnsupportedCommOperationException (Unsupported major.minor version 49.0) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at java.net.URLClassLoader.defineClass(URLClassLoader.java:251) at java.net.URLClassLoader.access$100(URLClassLoader.java:55) at java.net.URLClassLoader$1.run(URLClassLoader.java:194) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:187) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:141) I'm trying to run it with 1.4. thanks Ricardo From taj at www.linux.org.uk Tue Apr 5 00:48:12 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 07:48:12 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42515A83.4050907@emation.pt> References: <42515A83.4050907@emation.pt> Message-ID: On Mon, 4 Apr 2005, Ricardo Trindade wrote: > Hi, > > I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most > recent stable snapshot), and get the following exception : > > It looks like rxtx has been compiled with jdk 1.5. If this was > indeed the case, I think there is a compilation flag that generates code > that runs on older jdks. > > java.lang.UnsupportedClassVersionError: > gnu/io/UnsupportedCommOperationException (Unsupported major.minor > version 49.0) [snip] Thanks Ricardo I recompiled the jar with javac -source 1.3 -target 1.3. That should cover most of the JRE's in use today. I also compiled the rxtx 2.0 x86_64 native library which appeared to be missing. I tried looking for flags to pass gcc 4.0 to make the native libraries more backwards compatible but only found options for C++ which is not used in rxtx. I've got a list of other bugs that I'll be going through in the next few weeks but for now I just left them with the same CVS filename - no code changes. ftp://ftp.qbang.org/pub/rxtx/rxtx-2.0-CVS-20050120-bins.tar.gz ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-CVS-20050120-bins.tar.gz -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Tue Apr 5 02:24:33 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 05 Apr 2005 09:24:33 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: References: <42515A83.4050907@emation.pt> Message-ID: <42524B41.3040300@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050405/5919abbb/attachment-0148.html From taj at www.linux.org.uk Tue Apr 5 03:00:29 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 10:00:29 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42524B41.3040300@emation.pt> References: <42515A83.4050907@emation.pt> <42524B41.3040300@emation.pt> Message-ID: On Tue, 5 Apr 2005, Ricardo Trindade wrote: > Will you anounce to the list when a new release is available ? > There will be several incremental releases announced here. Once those are done, we will release 2.1.7 and 2.0.7. -- Trent Jarvi taj at www.linux.org.uk From no_spam at somewhere.com Tue Apr 5 11:55:37 2005 From: no_spam at somewhere.com (no_spam@somewhere.com) Date: Tue, 5 Apr 2005 13:55:37 -0400 Subject: [Rxtx] Closing a port from an event listener results in a deadlock Message-ID: <20050405175537.GA21747@rcog.homelinux.net> On the message I sent on March 14, does anyone had the chance to try the modification? Or was it already fixed? (I haven't searched the archive extensively) Or maybe my message got catched by some spam filters? (it made it to the list archive though) Anyway, I would appreciate some feedback (through the list) Thanks From taj at www.linux.org.uk Tue Apr 5 14:42:28 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 21:42:28 +0100 (BST) Subject: [Rxtx] Closing a port from an event listener results in a deadlock In-Reply-To: <20050405175537.GA21747@rcog.homelinux.net> References: <20050405175537.GA21747@rcog.homelinux.net> Message-ID: On Tue, 5 Apr 2005 no_spam at somewhere.com wrote: > On the message I sent on March 14, does anyone had the chance to try the > modification? > > Or was it already fixed? (I haven't searched the archive extensively) > > Or maybe my message got catched by some spam filters? (it made it to the list > archive though) > > Anyway, I would appreciate some feedback (through the list) > The patch is here http://marc.theaimsgroup.com/?l=rxtx&m=111084488820288&w=2 I have applied this patch to a local copy but will not be doing formal testing for a couple weeks. I do not try to close ports from inside the eventListenter usually so I encourage any feedback also. If there are no problems reported, I expect this will go into rxtx 2.1-7. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Wed Apr 6 08:33:42 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Wed, 06 Apr 2005 15:33:42 +0100 Subject: [Rxtx] getting RXTX version Message-ID: <4253F346.50102@emation.pt> Hi, I want to make sure my deployments have the same version of RXTX jar and native lib. I know the version of the jar can be obtained in the Version class, but how can I obtain the native version ? I know RXTX prints to the console a warning if the version is different. Is there a way to programatically know is this is the case ? I would like to log that to our app's log thanks Ricardo From taj at www.linux.org.uk Wed Apr 6 15:10:20 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 6 Apr 2005 22:10:20 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4253F346.50102@emation.pt> References: <4253F346.50102@emation.pt> Message-ID: On Wed, 6 Apr 2005, Ricardo Trindade wrote: > Hi, > > I want to make sure my deployments have the same version of RXTX jar > and native lib. > > I know the version of the jar can be obtained in the Version class, > but how can I obtain the native version ? > > I know RXTX prints to the console a warning if the version is > different. Is there a way to programatically know is this is the case ? > > I would like to log that to our app's log > There isn't a suggested way of doing that right now. We could move things around and have a static String RXTXVersion.getNativeVersion() in future releases. Is this what you expected? This is not documented in commapi at all. I just tossed that in to catch conflicts while developing. It would be nice to have access in GUI applications though. It may be possible to access RXTXCommDriver.LibVersion right now. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Thu Apr 7 02:51:00 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 09:51:00 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> Message-ID: <4254F474.7020905@emation.pt> >There isn't a suggested way of doing that right now. We could move things >around and have a static String RXTXVersion.getNativeVersion() in future >releases. Is this what you expected? > > Yes, that would be perfect. >This is not documented in commapi at all. I just tossed that in to catch >conflicts while developing. It would be nice to have access in GUI >applications though. > >It may be possible to access RXTXCommDriver.LibVersion right now. > > > I tried, and I don't think it's possible. From taj at www.linux.org.uk Thu Apr 7 03:32:04 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 7 Apr 2005 10:32:04 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4254F474.7020905@emation.pt> References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: On Thu, 7 Apr 2005, Ricardo Trindade wrote: > > >There isn't a suggested way of doing that right now. We could move things > >around and have a static String RXTXVersion.getNativeVersion() in future > >releases. Is this what you expected? > > > > > > Yes, that would be perfect. > The attached should do what you want. You will still need to catch an exception for older versions... -- Trent Jarvi taj at www.linux.org.uk -------------- next part -------------- ? public_version.patch Index: RXTXCommDriver.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXCommDriver.java,v retrieving revision 1.16.2.51 diff -u -r1.16.2.51 RXTXCommDriver.java --- RXTXCommDriver.java 12 Oct 2004 09:13:30 -0000 1.16.2.51 +++ RXTXCommDriver.java 7 Apr 2005 09:29:04 -0000 @@ -54,7 +54,7 @@ the Library. */ String JarVersion = RXTXVersion.getVersion(); - String LibVersion = nativeGetVersion(); + String LibVersion = RXTXVersion.nativeGetVersion(); if ( devel ) { System.out.println("Devel Library"); @@ -76,7 +76,6 @@ /** Get the Serial port prefixes for the running OS */ private String deviceDirectory; private String osName; - private static native String nativeGetVersion(); private native boolean registerKnownPorts(int PortType); private native boolean isPortPrefixValid(String dev); private native boolean testRead(String dev, int type); Index: RXTXVersion.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXVersion.java,v retrieving revision 1.2.2.31 diff -u -r1.2.2.31 RXTXVersion.java --- RXTXVersion.java 16 Oct 2004 16:20:35 -0000 1.2.2.31 +++ RXTXVersion.java 7 Apr 2005 09:29:04 -0000 @@ -36,6 +36,7 @@ private static String Version; static { + System.loadLibrary( "rxtxSerial" ); Version = "RXTX-2.1-7pre20"; } /** @@ -47,4 +48,5 @@ { return(Version); } + public static native String nativeGetVersion(); } Index: SerialImp.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v retrieving revision 1.46.2.181 diff -u -r1.46.2.181 SerialImp.c --- SerialImp.c 17 Oct 2004 09:48:56 -0000 1.46.2.181 +++ SerialImp.c 7 Apr 2005 09:29:07 -0000 @@ -116,6 +116,7 @@ * It will eventually be removed. * */ #define RXTXPort(foo) Java_gnu_io_RXTXPort_ ## foo +#define RXTXVersion(foo) Java_gnu_io_RXTXVersion_ ## foo #define RXTXCommDriver(foo) Java_gnu_io_RXTXCommDriver_ ## foo #if defined(__sun__) || defined(__hpux__) @@ -4001,7 +4002,7 @@ } /*---------------------------------------------------------- -RXTXCommDriver.nativeGetVersion +RXTXVersion.nativeGetVersion accept: none perform: return the current version @@ -4010,9 +4011,10 @@ comments: This is used to avoid mixing versions of the .jar and native library. First introduced in rxtx-1.5-9 + Moved from RXTXCommDriver to RXTXVersion in rxtx-2.1-7 ----------------------------------------------------------*/ -JNIEXPORT jstring JNICALL RXTXCommDriver(nativeGetVersion) (JNIEnv *env, +JNIEXPORT jstring JNICALL RXTXVersion(nativeGetVersion) (JNIEnv *env, jclass jclazz ) { return (*env)->NewStringUTF( env, "RXTX-2.1-7pre20" ); From ricardo.trindade at emation.pt Thu Apr 7 03:45:58 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 10:45:58 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: <42550156.2040908@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050407/05212451/attachment-0148.html From thomas.shulok at lmco.com Thu Apr 7 17:43:11 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Thu, 07 Apr 2005 19:43:11 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi There, I'm attempting to talk RS232 between an embedded Linux box and a Windows box. Everything connects up fine, and I can send and receive a simple sequence of bytes with no problems. However, if around 5 seconds goes by without me sending something, I get the following when I attempt to send. java.io.IOException: Input/output error in writeArray Stack trace: java/lang/Throwable.()V java/lang/Throwable.(Ljava/lang/String;)V java/io/IOException.(Ljava/lang/String;)V gnu/io/RXTXPort.writeArray([BIIZ)V gnu/io/RXTXPort$SerialOutputStream.write([B)V SerialTest.main([Ljava/lang/String;)V If there interval is shorter (say 2 seconds between sends), I have no problems. On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and librxtxSerial-2.0.7pre2.so. Any ideas? Thanks, Thom -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5b23dcf/attachment-0148.html From taj at www.linux.org.uk Thu Apr 7 19:22:36 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:22:36 +0100 (BST) Subject: [Rxtx] Input/output error in writeArray In-Reply-To: References: Message-ID: On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a Windows > box. Everything connects up fine, and I can send and receive a simple > sequence of bytes with no problems. However, if around 5 seconds goes > by without me sending something, I get the following when I attempt to > send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Apr 7 19:24:59 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:24:59 +0100 (BST) Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) Message-ID: hmm. This would not work from applets would it? -- Trent Jarvi taj at www.linux.org.uk ---------- Forwarded message ---------- Date: Thu, 07 Apr 2005 16:05:53 -0400 From: Chris Gaffney To: taj at www.linux.org.uk Subject: RXTX Libraries on Classpath fix Hi, I submitted a patch for RXTX a few weeks ago to allow for loading the native libraries from the classpath. Since sending it to you I found it wasn't working on windows. I've fixed the problem and created a new patch that should replace the older one. The actual change is a one line from a String.equals() to a String.startsWith(). Thanks for a great piece of software, -Chris Gaffney Grand Valley State University -------------- next part -------------- A non-text attachment was scrubbed... Name: libraries_on_classpath_fixed.patch Type: text/x-patch Size: 5617 bytes Desc: Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5d423b8/libraries_on_classpath_fixed-0148.bin From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From thomas.shulok at lmco.com Fri Apr 8 10:38:55 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Fri, 08 Apr 2005 12:38:55 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi Trent, Thanks for the prompt response. Before diving deeper, I was wondering if there is a timeout parameter somewhere in the stack that I have not set properly. Given the nature of the failure (only fails if the line has been idle for a few seconds), it feels like some kind of timeout issue... Thanks again, Thom -----Original Message----- From: rxtx-bounces at mail.linuxgrrls.org [mailto:rxtx-bounces at mail.linuxgrrls.org] On Behalf Of Trent Jarvi Sent: Thursday, April 07, 2005 6:23 PM To: Java RXTX discussion Subject: Re: [Rxtx] Input/output error in writeArray On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a > Windows box. Everything connects up fine, and I can send and receive > a simple sequence of bytes with no problems. However, if around 5 > seconds goes by without me sending something, I get the following when > I attempt to send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at mail.linuxgrrls.org http://mail.linuxgrrls.org/mailman/listinfo/rxtx From ricardo.trindade at emation.pt Mon Apr 4 09:17:23 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Mon, 04 Apr 2005 16:17:23 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot Message-ID: <42515A83.4050907@emation.pt> Hi, I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most recent stable snapshot), and get the following exception : It looks like rxtx has been compiled with jdk 1.5. If this was indeed the case, I think there is a compilation flag that generates code that runs on older jdks. java.lang.UnsupportedClassVersionError: gnu/io/UnsupportedCommOperationException (Unsupported major.minor version 49.0) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at java.net.URLClassLoader.defineClass(URLClassLoader.java:251) at java.net.URLClassLoader.access$100(URLClassLoader.java:55) at java.net.URLClassLoader$1.run(URLClassLoader.java:194) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:187) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:141) I'm trying to run it with 1.4. thanks Ricardo From taj at www.linux.org.uk Tue Apr 5 00:48:12 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 07:48:12 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42515A83.4050907@emation.pt> References: <42515A83.4050907@emation.pt> Message-ID: On Mon, 4 Apr 2005, Ricardo Trindade wrote: > Hi, > > I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most > recent stable snapshot), and get the following exception : > > It looks like rxtx has been compiled with jdk 1.5. If this was > indeed the case, I think there is a compilation flag that generates code > that runs on older jdks. > > java.lang.UnsupportedClassVersionError: > gnu/io/UnsupportedCommOperationException (Unsupported major.minor > version 49.0) [snip] Thanks Ricardo I recompiled the jar with javac -source 1.3 -target 1.3. That should cover most of the JRE's in use today. I also compiled the rxtx 2.0 x86_64 native library which appeared to be missing. I tried looking for flags to pass gcc 4.0 to make the native libraries more backwards compatible but only found options for C++ which is not used in rxtx. I've got a list of other bugs that I'll be going through in the next few weeks but for now I just left them with the same CVS filename - no code changes. ftp://ftp.qbang.org/pub/rxtx/rxtx-2.0-CVS-20050120-bins.tar.gz ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-CVS-20050120-bins.tar.gz -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Tue Apr 5 02:24:33 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 05 Apr 2005 09:24:33 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: References: <42515A83.4050907@emation.pt> Message-ID: <42524B41.3040300@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050405/5919abbb/attachment-0149.html From taj at www.linux.org.uk Tue Apr 5 03:00:29 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 10:00:29 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42524B41.3040300@emation.pt> References: <42515A83.4050907@emation.pt> <42524B41.3040300@emation.pt> Message-ID: On Tue, 5 Apr 2005, Ricardo Trindade wrote: > Will you anounce to the list when a new release is available ? > There will be several incremental releases announced here. Once those are done, we will release 2.1.7 and 2.0.7. -- Trent Jarvi taj at www.linux.org.uk From no_spam at somewhere.com Tue Apr 5 11:55:37 2005 From: no_spam at somewhere.com (no_spam@somewhere.com) Date: Tue, 5 Apr 2005 13:55:37 -0400 Subject: [Rxtx] Closing a port from an event listener results in a deadlock Message-ID: <20050405175537.GA21747@rcog.homelinux.net> On the message I sent on March 14, does anyone had the chance to try the modification? Or was it already fixed? (I haven't searched the archive extensively) Or maybe my message got catched by some spam filters? (it made it to the list archive though) Anyway, I would appreciate some feedback (through the list) Thanks From taj at www.linux.org.uk Tue Apr 5 14:42:28 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 21:42:28 +0100 (BST) Subject: [Rxtx] Closing a port from an event listener results in a deadlock In-Reply-To: <20050405175537.GA21747@rcog.homelinux.net> References: <20050405175537.GA21747@rcog.homelinux.net> Message-ID: On Tue, 5 Apr 2005 no_spam at somewhere.com wrote: > On the message I sent on March 14, does anyone had the chance to try the > modification? > > Or was it already fixed? (I haven't searched the archive extensively) > > Or maybe my message got catched by some spam filters? (it made it to the list > archive though) > > Anyway, I would appreciate some feedback (through the list) > The patch is here http://marc.theaimsgroup.com/?l=rxtx&m=111084488820288&w=2 I have applied this patch to a local copy but will not be doing formal testing for a couple weeks. I do not try to close ports from inside the eventListenter usually so I encourage any feedback also. If there are no problems reported, I expect this will go into rxtx 2.1-7. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Wed Apr 6 08:33:42 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Wed, 06 Apr 2005 15:33:42 +0100 Subject: [Rxtx] getting RXTX version Message-ID: <4253F346.50102@emation.pt> Hi, I want to make sure my deployments have the same version of RXTX jar and native lib. I know the version of the jar can be obtained in the Version class, but how can I obtain the native version ? I know RXTX prints to the console a warning if the version is different. Is there a way to programatically know is this is the case ? I would like to log that to our app's log thanks Ricardo From taj at www.linux.org.uk Wed Apr 6 15:10:20 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 6 Apr 2005 22:10:20 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4253F346.50102@emation.pt> References: <4253F346.50102@emation.pt> Message-ID: On Wed, 6 Apr 2005, Ricardo Trindade wrote: > Hi, > > I want to make sure my deployments have the same version of RXTX jar > and native lib. > > I know the version of the jar can be obtained in the Version class, > but how can I obtain the native version ? > > I know RXTX prints to the console a warning if the version is > different. Is there a way to programatically know is this is the case ? > > I would like to log that to our app's log > There isn't a suggested way of doing that right now. We could move things around and have a static String RXTXVersion.getNativeVersion() in future releases. Is this what you expected? This is not documented in commapi at all. I just tossed that in to catch conflicts while developing. It would be nice to have access in GUI applications though. It may be possible to access RXTXCommDriver.LibVersion right now. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Thu Apr 7 02:51:00 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 09:51:00 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> Message-ID: <4254F474.7020905@emation.pt> >There isn't a suggested way of doing that right now. We could move things >around and have a static String RXTXVersion.getNativeVersion() in future >releases. Is this what you expected? > > Yes, that would be perfect. >This is not documented in commapi at all. I just tossed that in to catch >conflicts while developing. It would be nice to have access in GUI >applications though. > >It may be possible to access RXTXCommDriver.LibVersion right now. > > > I tried, and I don't think it's possible. From taj at www.linux.org.uk Thu Apr 7 03:32:04 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 7 Apr 2005 10:32:04 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4254F474.7020905@emation.pt> References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: On Thu, 7 Apr 2005, Ricardo Trindade wrote: > > >There isn't a suggested way of doing that right now. We could move things > >around and have a static String RXTXVersion.getNativeVersion() in future > >releases. Is this what you expected? > > > > > > Yes, that would be perfect. > The attached should do what you want. You will still need to catch an exception for older versions... -- Trent Jarvi taj at www.linux.org.uk -------------- next part -------------- ? public_version.patch Index: RXTXCommDriver.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXCommDriver.java,v retrieving revision 1.16.2.51 diff -u -r1.16.2.51 RXTXCommDriver.java --- RXTXCommDriver.java 12 Oct 2004 09:13:30 -0000 1.16.2.51 +++ RXTXCommDriver.java 7 Apr 2005 09:29:04 -0000 @@ -54,7 +54,7 @@ the Library. */ String JarVersion = RXTXVersion.getVersion(); - String LibVersion = nativeGetVersion(); + String LibVersion = RXTXVersion.nativeGetVersion(); if ( devel ) { System.out.println("Devel Library"); @@ -76,7 +76,6 @@ /** Get the Serial port prefixes for the running OS */ private String deviceDirectory; private String osName; - private static native String nativeGetVersion(); private native boolean registerKnownPorts(int PortType); private native boolean isPortPrefixValid(String dev); private native boolean testRead(String dev, int type); Index: RXTXVersion.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXVersion.java,v retrieving revision 1.2.2.31 diff -u -r1.2.2.31 RXTXVersion.java --- RXTXVersion.java 16 Oct 2004 16:20:35 -0000 1.2.2.31 +++ RXTXVersion.java 7 Apr 2005 09:29:04 -0000 @@ -36,6 +36,7 @@ private static String Version; static { + System.loadLibrary( "rxtxSerial" ); Version = "RXTX-2.1-7pre20"; } /** @@ -47,4 +48,5 @@ { return(Version); } + public static native String nativeGetVersion(); } Index: SerialImp.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v retrieving revision 1.46.2.181 diff -u -r1.46.2.181 SerialImp.c --- SerialImp.c 17 Oct 2004 09:48:56 -0000 1.46.2.181 +++ SerialImp.c 7 Apr 2005 09:29:07 -0000 @@ -116,6 +116,7 @@ * It will eventually be removed. * */ #define RXTXPort(foo) Java_gnu_io_RXTXPort_ ## foo +#define RXTXVersion(foo) Java_gnu_io_RXTXVersion_ ## foo #define RXTXCommDriver(foo) Java_gnu_io_RXTXCommDriver_ ## foo #if defined(__sun__) || defined(__hpux__) @@ -4001,7 +4002,7 @@ } /*---------------------------------------------------------- -RXTXCommDriver.nativeGetVersion +RXTXVersion.nativeGetVersion accept: none perform: return the current version @@ -4010,9 +4011,10 @@ comments: This is used to avoid mixing versions of the .jar and native library. First introduced in rxtx-1.5-9 + Moved from RXTXCommDriver to RXTXVersion in rxtx-2.1-7 ----------------------------------------------------------*/ -JNIEXPORT jstring JNICALL RXTXCommDriver(nativeGetVersion) (JNIEnv *env, +JNIEXPORT jstring JNICALL RXTXVersion(nativeGetVersion) (JNIEnv *env, jclass jclazz ) { return (*env)->NewStringUTF( env, "RXTX-2.1-7pre20" ); From ricardo.trindade at emation.pt Thu Apr 7 03:45:58 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 10:45:58 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: <42550156.2040908@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050407/05212451/attachment-0149.html From thomas.shulok at lmco.com Thu Apr 7 17:43:11 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Thu, 07 Apr 2005 19:43:11 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi There, I'm attempting to talk RS232 between an embedded Linux box and a Windows box. Everything connects up fine, and I can send and receive a simple sequence of bytes with no problems. However, if around 5 seconds goes by without me sending something, I get the following when I attempt to send. java.io.IOException: Input/output error in writeArray Stack trace: java/lang/Throwable.()V java/lang/Throwable.(Ljava/lang/String;)V java/io/IOException.(Ljava/lang/String;)V gnu/io/RXTXPort.writeArray([BIIZ)V gnu/io/RXTXPort$SerialOutputStream.write([B)V SerialTest.main([Ljava/lang/String;)V If there interval is shorter (say 2 seconds between sends), I have no problems. On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and librxtxSerial-2.0.7pre2.so. Any ideas? Thanks, Thom -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5b23dcf/attachment-0149.html From taj at www.linux.org.uk Thu Apr 7 19:22:36 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:22:36 +0100 (BST) Subject: [Rxtx] Input/output error in writeArray In-Reply-To: References: Message-ID: On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a Windows > box. Everything connects up fine, and I can send and receive a simple > sequence of bytes with no problems. However, if around 5 seconds goes > by without me sending something, I get the following when I attempt to > send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Apr 7 19:24:59 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:24:59 +0100 (BST) Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) Message-ID: hmm. This would not work from applets would it? -- Trent Jarvi taj at www.linux.org.uk ---------- Forwarded message ---------- Date: Thu, 07 Apr 2005 16:05:53 -0400 From: Chris Gaffney To: taj at www.linux.org.uk Subject: RXTX Libraries on Classpath fix Hi, I submitted a patch for RXTX a few weeks ago to allow for loading the native libraries from the classpath. Since sending it to you I found it wasn't working on windows. I've fixed the problem and created a new patch that should replace the older one. The actual change is a one line from a String.equals() to a String.startsWith(). Thanks for a great piece of software, -Chris Gaffney Grand Valley State University -------------- next part -------------- A non-text attachment was scrubbed... Name: libraries_on_classpath_fixed.patch Type: text/x-patch Size: 5617 bytes Desc: Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5d423b8/libraries_on_classpath_fixed-0149.bin From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From thomas.shulok at lmco.com Fri Apr 8 10:38:55 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Fri, 08 Apr 2005 12:38:55 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi Trent, Thanks for the prompt response. Before diving deeper, I was wondering if there is a timeout parameter somewhere in the stack that I have not set properly. Given the nature of the failure (only fails if the line has been idle for a few seconds), it feels like some kind of timeout issue... Thanks again, Thom -----Original Message----- From: rxtx-bounces at mail.linuxgrrls.org [mailto:rxtx-bounces at mail.linuxgrrls.org] On Behalf Of Trent Jarvi Sent: Thursday, April 07, 2005 6:23 PM To: Java RXTX discussion Subject: Re: [Rxtx] Input/output error in writeArray On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a > Windows box. Everything connects up fine, and I can send and receive > a simple sequence of bytes with no problems. However, if around 5 > seconds goes by without me sending something, I get the following when > I attempt to send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at mail.linuxgrrls.org http://mail.linuxgrrls.org/mailman/listinfo/rxtx From ricardo.trindade at emation.pt Mon Apr 4 09:17:23 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Mon, 04 Apr 2005 16:17:23 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot Message-ID: <42515A83.4050907@emation.pt> Hi, I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most recent stable snapshot), and get the following exception : It looks like rxtx has been compiled with jdk 1.5. If this was indeed the case, I think there is a compilation flag that generates code that runs on older jdks. java.lang.UnsupportedClassVersionError: gnu/io/UnsupportedCommOperationException (Unsupported major.minor version 49.0) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at java.net.URLClassLoader.defineClass(URLClassLoader.java:251) at java.net.URLClassLoader.access$100(URLClassLoader.java:55) at java.net.URLClassLoader$1.run(URLClassLoader.java:194) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:187) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:141) I'm trying to run it with 1.4. thanks Ricardo From taj at www.linux.org.uk Tue Apr 5 00:48:12 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 07:48:12 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42515A83.4050907@emation.pt> References: <42515A83.4050907@emation.pt> Message-ID: On Mon, 4 Apr 2005, Ricardo Trindade wrote: > Hi, > > I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most > recent stable snapshot), and get the following exception : > > It looks like rxtx has been compiled with jdk 1.5. If this was > indeed the case, I think there is a compilation flag that generates code > that runs on older jdks. > > java.lang.UnsupportedClassVersionError: > gnu/io/UnsupportedCommOperationException (Unsupported major.minor > version 49.0) [snip] Thanks Ricardo I recompiled the jar with javac -source 1.3 -target 1.3. That should cover most of the JRE's in use today. I also compiled the rxtx 2.0 x86_64 native library which appeared to be missing. I tried looking for flags to pass gcc 4.0 to make the native libraries more backwards compatible but only found options for C++ which is not used in rxtx. I've got a list of other bugs that I'll be going through in the next few weeks but for now I just left them with the same CVS filename - no code changes. ftp://ftp.qbang.org/pub/rxtx/rxtx-2.0-CVS-20050120-bins.tar.gz ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-CVS-20050120-bins.tar.gz -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Tue Apr 5 02:24:33 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 05 Apr 2005 09:24:33 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: References: <42515A83.4050907@emation.pt> Message-ID: <42524B41.3040300@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050405/5919abbb/attachment-0150.html From taj at www.linux.org.uk Tue Apr 5 03:00:29 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 10:00:29 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42524B41.3040300@emation.pt> References: <42515A83.4050907@emation.pt> <42524B41.3040300@emation.pt> Message-ID: On Tue, 5 Apr 2005, Ricardo Trindade wrote: > Will you anounce to the list when a new release is available ? > There will be several incremental releases announced here. Once those are done, we will release 2.1.7 and 2.0.7. -- Trent Jarvi taj at www.linux.org.uk From no_spam at somewhere.com Tue Apr 5 11:55:37 2005 From: no_spam at somewhere.com (no_spam@somewhere.com) Date: Tue, 5 Apr 2005 13:55:37 -0400 Subject: [Rxtx] Closing a port from an event listener results in a deadlock Message-ID: <20050405175537.GA21747@rcog.homelinux.net> On the message I sent on March 14, does anyone had the chance to try the modification? Or was it already fixed? (I haven't searched the archive extensively) Or maybe my message got catched by some spam filters? (it made it to the list archive though) Anyway, I would appreciate some feedback (through the list) Thanks From taj at www.linux.org.uk Tue Apr 5 14:42:28 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 21:42:28 +0100 (BST) Subject: [Rxtx] Closing a port from an event listener results in a deadlock In-Reply-To: <20050405175537.GA21747@rcog.homelinux.net> References: <20050405175537.GA21747@rcog.homelinux.net> Message-ID: On Tue, 5 Apr 2005 no_spam at somewhere.com wrote: > On the message I sent on March 14, does anyone had the chance to try the > modification? > > Or was it already fixed? (I haven't searched the archive extensively) > > Or maybe my message got catched by some spam filters? (it made it to the list > archive though) > > Anyway, I would appreciate some feedback (through the list) > The patch is here http://marc.theaimsgroup.com/?l=rxtx&m=111084488820288&w=2 I have applied this patch to a local copy but will not be doing formal testing for a couple weeks. I do not try to close ports from inside the eventListenter usually so I encourage any feedback also. If there are no problems reported, I expect this will go into rxtx 2.1-7. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Wed Apr 6 08:33:42 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Wed, 06 Apr 2005 15:33:42 +0100 Subject: [Rxtx] getting RXTX version Message-ID: <4253F346.50102@emation.pt> Hi, I want to make sure my deployments have the same version of RXTX jar and native lib. I know the version of the jar can be obtained in the Version class, but how can I obtain the native version ? I know RXTX prints to the console a warning if the version is different. Is there a way to programatically know is this is the case ? I would like to log that to our app's log thanks Ricardo From taj at www.linux.org.uk Wed Apr 6 15:10:20 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 6 Apr 2005 22:10:20 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4253F346.50102@emation.pt> References: <4253F346.50102@emation.pt> Message-ID: On Wed, 6 Apr 2005, Ricardo Trindade wrote: > Hi, > > I want to make sure my deployments have the same version of RXTX jar > and native lib. > > I know the version of the jar can be obtained in the Version class, > but how can I obtain the native version ? > > I know RXTX prints to the console a warning if the version is > different. Is there a way to programatically know is this is the case ? > > I would like to log that to our app's log > There isn't a suggested way of doing that right now. We could move things around and have a static String RXTXVersion.getNativeVersion() in future releases. Is this what you expected? This is not documented in commapi at all. I just tossed that in to catch conflicts while developing. It would be nice to have access in GUI applications though. It may be possible to access RXTXCommDriver.LibVersion right now. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Thu Apr 7 02:51:00 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 09:51:00 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> Message-ID: <4254F474.7020905@emation.pt> >There isn't a suggested way of doing that right now. We could move things >around and have a static String RXTXVersion.getNativeVersion() in future >releases. Is this what you expected? > > Yes, that would be perfect. >This is not documented in commapi at all. I just tossed that in to catch >conflicts while developing. It would be nice to have access in GUI >applications though. > >It may be possible to access RXTXCommDriver.LibVersion right now. > > > I tried, and I don't think it's possible. From taj at www.linux.org.uk Thu Apr 7 03:32:04 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 7 Apr 2005 10:32:04 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4254F474.7020905@emation.pt> References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: On Thu, 7 Apr 2005, Ricardo Trindade wrote: > > >There isn't a suggested way of doing that right now. We could move things > >around and have a static String RXTXVersion.getNativeVersion() in future > >releases. Is this what you expected? > > > > > > Yes, that would be perfect. > The attached should do what you want. You will still need to catch an exception for older versions... -- Trent Jarvi taj at www.linux.org.uk -------------- next part -------------- ? public_version.patch Index: RXTXCommDriver.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXCommDriver.java,v retrieving revision 1.16.2.51 diff -u -r1.16.2.51 RXTXCommDriver.java --- RXTXCommDriver.java 12 Oct 2004 09:13:30 -0000 1.16.2.51 +++ RXTXCommDriver.java 7 Apr 2005 09:29:04 -0000 @@ -54,7 +54,7 @@ the Library. */ String JarVersion = RXTXVersion.getVersion(); - String LibVersion = nativeGetVersion(); + String LibVersion = RXTXVersion.nativeGetVersion(); if ( devel ) { System.out.println("Devel Library"); @@ -76,7 +76,6 @@ /** Get the Serial port prefixes for the running OS */ private String deviceDirectory; private String osName; - private static native String nativeGetVersion(); private native boolean registerKnownPorts(int PortType); private native boolean isPortPrefixValid(String dev); private native boolean testRead(String dev, int type); Index: RXTXVersion.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXVersion.java,v retrieving revision 1.2.2.31 diff -u -r1.2.2.31 RXTXVersion.java --- RXTXVersion.java 16 Oct 2004 16:20:35 -0000 1.2.2.31 +++ RXTXVersion.java 7 Apr 2005 09:29:04 -0000 @@ -36,6 +36,7 @@ private static String Version; static { + System.loadLibrary( "rxtxSerial" ); Version = "RXTX-2.1-7pre20"; } /** @@ -47,4 +48,5 @@ { return(Version); } + public static native String nativeGetVersion(); } Index: SerialImp.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v retrieving revision 1.46.2.181 diff -u -r1.46.2.181 SerialImp.c --- SerialImp.c 17 Oct 2004 09:48:56 -0000 1.46.2.181 +++ SerialImp.c 7 Apr 2005 09:29:07 -0000 @@ -116,6 +116,7 @@ * It will eventually be removed. * */ #define RXTXPort(foo) Java_gnu_io_RXTXPort_ ## foo +#define RXTXVersion(foo) Java_gnu_io_RXTXVersion_ ## foo #define RXTXCommDriver(foo) Java_gnu_io_RXTXCommDriver_ ## foo #if defined(__sun__) || defined(__hpux__) @@ -4001,7 +4002,7 @@ } /*---------------------------------------------------------- -RXTXCommDriver.nativeGetVersion +RXTXVersion.nativeGetVersion accept: none perform: return the current version @@ -4010,9 +4011,10 @@ comments: This is used to avoid mixing versions of the .jar and native library. First introduced in rxtx-1.5-9 + Moved from RXTXCommDriver to RXTXVersion in rxtx-2.1-7 ----------------------------------------------------------*/ -JNIEXPORT jstring JNICALL RXTXCommDriver(nativeGetVersion) (JNIEnv *env, +JNIEXPORT jstring JNICALL RXTXVersion(nativeGetVersion) (JNIEnv *env, jclass jclazz ) { return (*env)->NewStringUTF( env, "RXTX-2.1-7pre20" ); From ricardo.trindade at emation.pt Thu Apr 7 03:45:58 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 10:45:58 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: <42550156.2040908@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050407/05212451/attachment-0150.html From thomas.shulok at lmco.com Thu Apr 7 17:43:11 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Thu, 07 Apr 2005 19:43:11 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi There, I'm attempting to talk RS232 between an embedded Linux box and a Windows box. Everything connects up fine, and I can send and receive a simple sequence of bytes with no problems. However, if around 5 seconds goes by without me sending something, I get the following when I attempt to send. java.io.IOException: Input/output error in writeArray Stack trace: java/lang/Throwable.()V java/lang/Throwable.(Ljava/lang/String;)V java/io/IOException.(Ljava/lang/String;)V gnu/io/RXTXPort.writeArray([BIIZ)V gnu/io/RXTXPort$SerialOutputStream.write([B)V SerialTest.main([Ljava/lang/String;)V If there interval is shorter (say 2 seconds between sends), I have no problems. On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and librxtxSerial-2.0.7pre2.so. Any ideas? Thanks, Thom -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5b23dcf/attachment-0150.html From taj at www.linux.org.uk Thu Apr 7 19:22:36 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:22:36 +0100 (BST) Subject: [Rxtx] Input/output error in writeArray In-Reply-To: References: Message-ID: On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a Windows > box. Everything connects up fine, and I can send and receive a simple > sequence of bytes with no problems. However, if around 5 seconds goes > by without me sending something, I get the following when I attempt to > send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Apr 7 19:24:59 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:24:59 +0100 (BST) Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) Message-ID: hmm. This would not work from applets would it? -- Trent Jarvi taj at www.linux.org.uk ---------- Forwarded message ---------- Date: Thu, 07 Apr 2005 16:05:53 -0400 From: Chris Gaffney To: taj at www.linux.org.uk Subject: RXTX Libraries on Classpath fix Hi, I submitted a patch for RXTX a few weeks ago to allow for loading the native libraries from the classpath. Since sending it to you I found it wasn't working on windows. I've fixed the problem and created a new patch that should replace the older one. The actual change is a one line from a String.equals() to a String.startsWith(). Thanks for a great piece of software, -Chris Gaffney Grand Valley State University -------------- next part -------------- A non-text attachment was scrubbed... Name: libraries_on_classpath_fixed.patch Type: text/x-patch Size: 5617 bytes Desc: Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5d423b8/libraries_on_classpath_fixed-0150.bin From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From thomas.shulok at lmco.com Fri Apr 8 10:38:55 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Fri, 08 Apr 2005 12:38:55 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi Trent, Thanks for the prompt response. Before diving deeper, I was wondering if there is a timeout parameter somewhere in the stack that I have not set properly. Given the nature of the failure (only fails if the line has been idle for a few seconds), it feels like some kind of timeout issue... Thanks again, Thom -----Original Message----- From: rxtx-bounces at mail.linuxgrrls.org [mailto:rxtx-bounces at mail.linuxgrrls.org] On Behalf Of Trent Jarvi Sent: Thursday, April 07, 2005 6:23 PM To: Java RXTX discussion Subject: Re: [Rxtx] Input/output error in writeArray On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a > Windows box. Everything connects up fine, and I can send and receive > a simple sequence of bytes with no problems. However, if around 5 > seconds goes by without me sending something, I get the following when > I attempt to send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at mail.linuxgrrls.org http://mail.linuxgrrls.org/mailman/listinfo/rxtx From ricardo.trindade at emation.pt Mon Apr 4 09:17:23 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Mon, 04 Apr 2005 16:17:23 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot Message-ID: <42515A83.4050907@emation.pt> Hi, I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most recent stable snapshot), and get the following exception : It looks like rxtx has been compiled with jdk 1.5. If this was indeed the case, I think there is a compilation flag that generates code that runs on older jdks. java.lang.UnsupportedClassVersionError: gnu/io/UnsupportedCommOperationException (Unsupported major.minor version 49.0) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at java.net.URLClassLoader.defineClass(URLClassLoader.java:251) at java.net.URLClassLoader.access$100(URLClassLoader.java:55) at java.net.URLClassLoader$1.run(URLClassLoader.java:194) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:187) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:141) I'm trying to run it with 1.4. thanks Ricardo From taj at www.linux.org.uk Tue Apr 5 00:48:12 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 07:48:12 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42515A83.4050907@emation.pt> References: <42515A83.4050907@emation.pt> Message-ID: On Mon, 4 Apr 2005, Ricardo Trindade wrote: > Hi, > > I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most > recent stable snapshot), and get the following exception : > > It looks like rxtx has been compiled with jdk 1.5. If this was > indeed the case, I think there is a compilation flag that generates code > that runs on older jdks. > > java.lang.UnsupportedClassVersionError: > gnu/io/UnsupportedCommOperationException (Unsupported major.minor > version 49.0) [snip] Thanks Ricardo I recompiled the jar with javac -source 1.3 -target 1.3. That should cover most of the JRE's in use today. I also compiled the rxtx 2.0 x86_64 native library which appeared to be missing. I tried looking for flags to pass gcc 4.0 to make the native libraries more backwards compatible but only found options for C++ which is not used in rxtx. I've got a list of other bugs that I'll be going through in the next few weeks but for now I just left them with the same CVS filename - no code changes. ftp://ftp.qbang.org/pub/rxtx/rxtx-2.0-CVS-20050120-bins.tar.gz ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-CVS-20050120-bins.tar.gz -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Tue Apr 5 02:24:33 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 05 Apr 2005 09:24:33 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: References: <42515A83.4050907@emation.pt> Message-ID: <42524B41.3040300@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050405/5919abbb/attachment-0151.html From taj at www.linux.org.uk Tue Apr 5 03:00:29 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 10:00:29 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42524B41.3040300@emation.pt> References: <42515A83.4050907@emation.pt> <42524B41.3040300@emation.pt> Message-ID: On Tue, 5 Apr 2005, Ricardo Trindade wrote: > Will you anounce to the list when a new release is available ? > There will be several incremental releases announced here. Once those are done, we will release 2.1.7 and 2.0.7. -- Trent Jarvi taj at www.linux.org.uk From no_spam at somewhere.com Tue Apr 5 11:55:37 2005 From: no_spam at somewhere.com (no_spam@somewhere.com) Date: Tue, 5 Apr 2005 13:55:37 -0400 Subject: [Rxtx] Closing a port from an event listener results in a deadlock Message-ID: <20050405175537.GA21747@rcog.homelinux.net> On the message I sent on March 14, does anyone had the chance to try the modification? Or was it already fixed? (I haven't searched the archive extensively) Or maybe my message got catched by some spam filters? (it made it to the list archive though) Anyway, I would appreciate some feedback (through the list) Thanks From taj at www.linux.org.uk Tue Apr 5 14:42:28 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 21:42:28 +0100 (BST) Subject: [Rxtx] Closing a port from an event listener results in a deadlock In-Reply-To: <20050405175537.GA21747@rcog.homelinux.net> References: <20050405175537.GA21747@rcog.homelinux.net> Message-ID: On Tue, 5 Apr 2005 no_spam at somewhere.com wrote: > On the message I sent on March 14, does anyone had the chance to try the > modification? > > Or was it already fixed? (I haven't searched the archive extensively) > > Or maybe my message got catched by some spam filters? (it made it to the list > archive though) > > Anyway, I would appreciate some feedback (through the list) > The patch is here http://marc.theaimsgroup.com/?l=rxtx&m=111084488820288&w=2 I have applied this patch to a local copy but will not be doing formal testing for a couple weeks. I do not try to close ports from inside the eventListenter usually so I encourage any feedback also. If there are no problems reported, I expect this will go into rxtx 2.1-7. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Wed Apr 6 08:33:42 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Wed, 06 Apr 2005 15:33:42 +0100 Subject: [Rxtx] getting RXTX version Message-ID: <4253F346.50102@emation.pt> Hi, I want to make sure my deployments have the same version of RXTX jar and native lib. I know the version of the jar can be obtained in the Version class, but how can I obtain the native version ? I know RXTX prints to the console a warning if the version is different. Is there a way to programatically know is this is the case ? I would like to log that to our app's log thanks Ricardo From taj at www.linux.org.uk Wed Apr 6 15:10:20 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 6 Apr 2005 22:10:20 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4253F346.50102@emation.pt> References: <4253F346.50102@emation.pt> Message-ID: On Wed, 6 Apr 2005, Ricardo Trindade wrote: > Hi, > > I want to make sure my deployments have the same version of RXTX jar > and native lib. > > I know the version of the jar can be obtained in the Version class, > but how can I obtain the native version ? > > I know RXTX prints to the console a warning if the version is > different. Is there a way to programatically know is this is the case ? > > I would like to log that to our app's log > There isn't a suggested way of doing that right now. We could move things around and have a static String RXTXVersion.getNativeVersion() in future releases. Is this what you expected? This is not documented in commapi at all. I just tossed that in to catch conflicts while developing. It would be nice to have access in GUI applications though. It may be possible to access RXTXCommDriver.LibVersion right now. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Thu Apr 7 02:51:00 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 09:51:00 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> Message-ID: <4254F474.7020905@emation.pt> >There isn't a suggested way of doing that right now. We could move things >around and have a static String RXTXVersion.getNativeVersion() in future >releases. Is this what you expected? > > Yes, that would be perfect. >This is not documented in commapi at all. I just tossed that in to catch >conflicts while developing. It would be nice to have access in GUI >applications though. > >It may be possible to access RXTXCommDriver.LibVersion right now. > > > I tried, and I don't think it's possible. From taj at www.linux.org.uk Thu Apr 7 03:32:04 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 7 Apr 2005 10:32:04 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4254F474.7020905@emation.pt> References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: On Thu, 7 Apr 2005, Ricardo Trindade wrote: > > >There isn't a suggested way of doing that right now. We could move things > >around and have a static String RXTXVersion.getNativeVersion() in future > >releases. Is this what you expected? > > > > > > Yes, that would be perfect. > The attached should do what you want. You will still need to catch an exception for older versions... -- Trent Jarvi taj at www.linux.org.uk -------------- next part -------------- ? public_version.patch Index: RXTXCommDriver.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXCommDriver.java,v retrieving revision 1.16.2.51 diff -u -r1.16.2.51 RXTXCommDriver.java --- RXTXCommDriver.java 12 Oct 2004 09:13:30 -0000 1.16.2.51 +++ RXTXCommDriver.java 7 Apr 2005 09:29:04 -0000 @@ -54,7 +54,7 @@ the Library. */ String JarVersion = RXTXVersion.getVersion(); - String LibVersion = nativeGetVersion(); + String LibVersion = RXTXVersion.nativeGetVersion(); if ( devel ) { System.out.println("Devel Library"); @@ -76,7 +76,6 @@ /** Get the Serial port prefixes for the running OS */ private String deviceDirectory; private String osName; - private static native String nativeGetVersion(); private native boolean registerKnownPorts(int PortType); private native boolean isPortPrefixValid(String dev); private native boolean testRead(String dev, int type); Index: RXTXVersion.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXVersion.java,v retrieving revision 1.2.2.31 diff -u -r1.2.2.31 RXTXVersion.java --- RXTXVersion.java 16 Oct 2004 16:20:35 -0000 1.2.2.31 +++ RXTXVersion.java 7 Apr 2005 09:29:04 -0000 @@ -36,6 +36,7 @@ private static String Version; static { + System.loadLibrary( "rxtxSerial" ); Version = "RXTX-2.1-7pre20"; } /** @@ -47,4 +48,5 @@ { return(Version); } + public static native String nativeGetVersion(); } Index: SerialImp.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v retrieving revision 1.46.2.181 diff -u -r1.46.2.181 SerialImp.c --- SerialImp.c 17 Oct 2004 09:48:56 -0000 1.46.2.181 +++ SerialImp.c 7 Apr 2005 09:29:07 -0000 @@ -116,6 +116,7 @@ * It will eventually be removed. * */ #define RXTXPort(foo) Java_gnu_io_RXTXPort_ ## foo +#define RXTXVersion(foo) Java_gnu_io_RXTXVersion_ ## foo #define RXTXCommDriver(foo) Java_gnu_io_RXTXCommDriver_ ## foo #if defined(__sun__) || defined(__hpux__) @@ -4001,7 +4002,7 @@ } /*---------------------------------------------------------- -RXTXCommDriver.nativeGetVersion +RXTXVersion.nativeGetVersion accept: none perform: return the current version @@ -4010,9 +4011,10 @@ comments: This is used to avoid mixing versions of the .jar and native library. First introduced in rxtx-1.5-9 + Moved from RXTXCommDriver to RXTXVersion in rxtx-2.1-7 ----------------------------------------------------------*/ -JNIEXPORT jstring JNICALL RXTXCommDriver(nativeGetVersion) (JNIEnv *env, +JNIEXPORT jstring JNICALL RXTXVersion(nativeGetVersion) (JNIEnv *env, jclass jclazz ) { return (*env)->NewStringUTF( env, "RXTX-2.1-7pre20" ); From ricardo.trindade at emation.pt Thu Apr 7 03:45:58 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 10:45:58 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: <42550156.2040908@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050407/05212451/attachment-0151.html From thomas.shulok at lmco.com Thu Apr 7 17:43:11 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Thu, 07 Apr 2005 19:43:11 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi There, I'm attempting to talk RS232 between an embedded Linux box and a Windows box. Everything connects up fine, and I can send and receive a simple sequence of bytes with no problems. However, if around 5 seconds goes by without me sending something, I get the following when I attempt to send. java.io.IOException: Input/output error in writeArray Stack trace: java/lang/Throwable.()V java/lang/Throwable.(Ljava/lang/String;)V java/io/IOException.(Ljava/lang/String;)V gnu/io/RXTXPort.writeArray([BIIZ)V gnu/io/RXTXPort$SerialOutputStream.write([B)V SerialTest.main([Ljava/lang/String;)V If there interval is shorter (say 2 seconds between sends), I have no problems. On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and librxtxSerial-2.0.7pre2.so. Any ideas? Thanks, Thom -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5b23dcf/attachment-0151.html From taj at www.linux.org.uk Thu Apr 7 19:22:36 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:22:36 +0100 (BST) Subject: [Rxtx] Input/output error in writeArray In-Reply-To: References: Message-ID: On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a Windows > box. Everything connects up fine, and I can send and receive a simple > sequence of bytes with no problems. However, if around 5 seconds goes > by without me sending something, I get the following when I attempt to > send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Apr 7 19:24:59 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:24:59 +0100 (BST) Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) Message-ID: hmm. This would not work from applets would it? -- Trent Jarvi taj at www.linux.org.uk ---------- Forwarded message ---------- Date: Thu, 07 Apr 2005 16:05:53 -0400 From: Chris Gaffney To: taj at www.linux.org.uk Subject: RXTX Libraries on Classpath fix Hi, I submitted a patch for RXTX a few weeks ago to allow for loading the native libraries from the classpath. Since sending it to you I found it wasn't working on windows. I've fixed the problem and created a new patch that should replace the older one. The actual change is a one line from a String.equals() to a String.startsWith(). Thanks for a great piece of software, -Chris Gaffney Grand Valley State University -------------- next part -------------- A non-text attachment was scrubbed... Name: libraries_on_classpath_fixed.patch Type: text/x-patch Size: 5617 bytes Desc: Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5d423b8/libraries_on_classpath_fixed-0151.bin From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From thomas.shulok at lmco.com Fri Apr 8 10:38:55 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Fri, 08 Apr 2005 12:38:55 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi Trent, Thanks for the prompt response. Before diving deeper, I was wondering if there is a timeout parameter somewhere in the stack that I have not set properly. Given the nature of the failure (only fails if the line has been idle for a few seconds), it feels like some kind of timeout issue... Thanks again, Thom -----Original Message----- From: rxtx-bounces at mail.linuxgrrls.org [mailto:rxtx-bounces at mail.linuxgrrls.org] On Behalf Of Trent Jarvi Sent: Thursday, April 07, 2005 6:23 PM To: Java RXTX discussion Subject: Re: [Rxtx] Input/output error in writeArray On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a > Windows box. Everything connects up fine, and I can send and receive > a simple sequence of bytes with no problems. However, if around 5 > seconds goes by without me sending something, I get the following when > I attempt to send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at mail.linuxgrrls.org http://mail.linuxgrrls.org/mailman/listinfo/rxtx From ricardo.trindade at emation.pt Mon Apr 4 09:17:23 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Mon, 04 Apr 2005 16:17:23 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot Message-ID: <42515A83.4050907@emation.pt> Hi, I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most recent stable snapshot), and get the following exception : It looks like rxtx has been compiled with jdk 1.5. If this was indeed the case, I think there is a compilation flag that generates code that runs on older jdks. java.lang.UnsupportedClassVersionError: gnu/io/UnsupportedCommOperationException (Unsupported major.minor version 49.0) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at java.net.URLClassLoader.defineClass(URLClassLoader.java:251) at java.net.URLClassLoader.access$100(URLClassLoader.java:55) at java.net.URLClassLoader$1.run(URLClassLoader.java:194) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:187) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:141) I'm trying to run it with 1.4. thanks Ricardo From taj at www.linux.org.uk Tue Apr 5 00:48:12 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 07:48:12 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42515A83.4050907@emation.pt> References: <42515A83.4050907@emation.pt> Message-ID: On Mon, 4 Apr 2005, Ricardo Trindade wrote: > Hi, > > I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most > recent stable snapshot), and get the following exception : > > It looks like rxtx has been compiled with jdk 1.5. If this was > indeed the case, I think there is a compilation flag that generates code > that runs on older jdks. > > java.lang.UnsupportedClassVersionError: > gnu/io/UnsupportedCommOperationException (Unsupported major.minor > version 49.0) [snip] Thanks Ricardo I recompiled the jar with javac -source 1.3 -target 1.3. That should cover most of the JRE's in use today. I also compiled the rxtx 2.0 x86_64 native library which appeared to be missing. I tried looking for flags to pass gcc 4.0 to make the native libraries more backwards compatible but only found options for C++ which is not used in rxtx. I've got a list of other bugs that I'll be going through in the next few weeks but for now I just left them with the same CVS filename - no code changes. ftp://ftp.qbang.org/pub/rxtx/rxtx-2.0-CVS-20050120-bins.tar.gz ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-CVS-20050120-bins.tar.gz -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Tue Apr 5 02:24:33 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 05 Apr 2005 09:24:33 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: References: <42515A83.4050907@emation.pt> Message-ID: <42524B41.3040300@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050405/5919abbb/attachment-0152.html From taj at www.linux.org.uk Tue Apr 5 03:00:29 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 10:00:29 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42524B41.3040300@emation.pt> References: <42515A83.4050907@emation.pt> <42524B41.3040300@emation.pt> Message-ID: On Tue, 5 Apr 2005, Ricardo Trindade wrote: > Will you anounce to the list when a new release is available ? > There will be several incremental releases announced here. Once those are done, we will release 2.1.7 and 2.0.7. -- Trent Jarvi taj at www.linux.org.uk From no_spam at somewhere.com Tue Apr 5 11:55:37 2005 From: no_spam at somewhere.com (no_spam@somewhere.com) Date: Tue, 5 Apr 2005 13:55:37 -0400 Subject: [Rxtx] Closing a port from an event listener results in a deadlock Message-ID: <20050405175537.GA21747@rcog.homelinux.net> On the message I sent on March 14, does anyone had the chance to try the modification? Or was it already fixed? (I haven't searched the archive extensively) Or maybe my message got catched by some spam filters? (it made it to the list archive though) Anyway, I would appreciate some feedback (through the list) Thanks From taj at www.linux.org.uk Tue Apr 5 14:42:28 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 21:42:28 +0100 (BST) Subject: [Rxtx] Closing a port from an event listener results in a deadlock In-Reply-To: <20050405175537.GA21747@rcog.homelinux.net> References: <20050405175537.GA21747@rcog.homelinux.net> Message-ID: On Tue, 5 Apr 2005 no_spam at somewhere.com wrote: > On the message I sent on March 14, does anyone had the chance to try the > modification? > > Or was it already fixed? (I haven't searched the archive extensively) > > Or maybe my message got catched by some spam filters? (it made it to the list > archive though) > > Anyway, I would appreciate some feedback (through the list) > The patch is here http://marc.theaimsgroup.com/?l=rxtx&m=111084488820288&w=2 I have applied this patch to a local copy but will not be doing formal testing for a couple weeks. I do not try to close ports from inside the eventListenter usually so I encourage any feedback also. If there are no problems reported, I expect this will go into rxtx 2.1-7. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Wed Apr 6 08:33:42 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Wed, 06 Apr 2005 15:33:42 +0100 Subject: [Rxtx] getting RXTX version Message-ID: <4253F346.50102@emation.pt> Hi, I want to make sure my deployments have the same version of RXTX jar and native lib. I know the version of the jar can be obtained in the Version class, but how can I obtain the native version ? I know RXTX prints to the console a warning if the version is different. Is there a way to programatically know is this is the case ? I would like to log that to our app's log thanks Ricardo From taj at www.linux.org.uk Wed Apr 6 15:10:20 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 6 Apr 2005 22:10:20 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4253F346.50102@emation.pt> References: <4253F346.50102@emation.pt> Message-ID: On Wed, 6 Apr 2005, Ricardo Trindade wrote: > Hi, > > I want to make sure my deployments have the same version of RXTX jar > and native lib. > > I know the version of the jar can be obtained in the Version class, > but how can I obtain the native version ? > > I know RXTX prints to the console a warning if the version is > different. Is there a way to programatically know is this is the case ? > > I would like to log that to our app's log > There isn't a suggested way of doing that right now. We could move things around and have a static String RXTXVersion.getNativeVersion() in future releases. Is this what you expected? This is not documented in commapi at all. I just tossed that in to catch conflicts while developing. It would be nice to have access in GUI applications though. It may be possible to access RXTXCommDriver.LibVersion right now. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Thu Apr 7 02:51:00 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 09:51:00 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> Message-ID: <4254F474.7020905@emation.pt> >There isn't a suggested way of doing that right now. We could move things >around and have a static String RXTXVersion.getNativeVersion() in future >releases. Is this what you expected? > > Yes, that would be perfect. >This is not documented in commapi at all. I just tossed that in to catch >conflicts while developing. It would be nice to have access in GUI >applications though. > >It may be possible to access RXTXCommDriver.LibVersion right now. > > > I tried, and I don't think it's possible. From taj at www.linux.org.uk Thu Apr 7 03:32:04 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 7 Apr 2005 10:32:04 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4254F474.7020905@emation.pt> References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: On Thu, 7 Apr 2005, Ricardo Trindade wrote: > > >There isn't a suggested way of doing that right now. We could move things > >around and have a static String RXTXVersion.getNativeVersion() in future > >releases. Is this what you expected? > > > > > > Yes, that would be perfect. > The attached should do what you want. You will still need to catch an exception for older versions... -- Trent Jarvi taj at www.linux.org.uk -------------- next part -------------- ? public_version.patch Index: RXTXCommDriver.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXCommDriver.java,v retrieving revision 1.16.2.51 diff -u -r1.16.2.51 RXTXCommDriver.java --- RXTXCommDriver.java 12 Oct 2004 09:13:30 -0000 1.16.2.51 +++ RXTXCommDriver.java 7 Apr 2005 09:29:04 -0000 @@ -54,7 +54,7 @@ the Library. */ String JarVersion = RXTXVersion.getVersion(); - String LibVersion = nativeGetVersion(); + String LibVersion = RXTXVersion.nativeGetVersion(); if ( devel ) { System.out.println("Devel Library"); @@ -76,7 +76,6 @@ /** Get the Serial port prefixes for the running OS */ private String deviceDirectory; private String osName; - private static native String nativeGetVersion(); private native boolean registerKnownPorts(int PortType); private native boolean isPortPrefixValid(String dev); private native boolean testRead(String dev, int type); Index: RXTXVersion.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXVersion.java,v retrieving revision 1.2.2.31 diff -u -r1.2.2.31 RXTXVersion.java --- RXTXVersion.java 16 Oct 2004 16:20:35 -0000 1.2.2.31 +++ RXTXVersion.java 7 Apr 2005 09:29:04 -0000 @@ -36,6 +36,7 @@ private static String Version; static { + System.loadLibrary( "rxtxSerial" ); Version = "RXTX-2.1-7pre20"; } /** @@ -47,4 +48,5 @@ { return(Version); } + public static native String nativeGetVersion(); } Index: SerialImp.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v retrieving revision 1.46.2.181 diff -u -r1.46.2.181 SerialImp.c --- SerialImp.c 17 Oct 2004 09:48:56 -0000 1.46.2.181 +++ SerialImp.c 7 Apr 2005 09:29:07 -0000 @@ -116,6 +116,7 @@ * It will eventually be removed. * */ #define RXTXPort(foo) Java_gnu_io_RXTXPort_ ## foo +#define RXTXVersion(foo) Java_gnu_io_RXTXVersion_ ## foo #define RXTXCommDriver(foo) Java_gnu_io_RXTXCommDriver_ ## foo #if defined(__sun__) || defined(__hpux__) @@ -4001,7 +4002,7 @@ } /*---------------------------------------------------------- -RXTXCommDriver.nativeGetVersion +RXTXVersion.nativeGetVersion accept: none perform: return the current version @@ -4010,9 +4011,10 @@ comments: This is used to avoid mixing versions of the .jar and native library. First introduced in rxtx-1.5-9 + Moved from RXTXCommDriver to RXTXVersion in rxtx-2.1-7 ----------------------------------------------------------*/ -JNIEXPORT jstring JNICALL RXTXCommDriver(nativeGetVersion) (JNIEnv *env, +JNIEXPORT jstring JNICALL RXTXVersion(nativeGetVersion) (JNIEnv *env, jclass jclazz ) { return (*env)->NewStringUTF( env, "RXTX-2.1-7pre20" ); From ricardo.trindade at emation.pt Thu Apr 7 03:45:58 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 10:45:58 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: <42550156.2040908@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050407/05212451/attachment-0152.html From thomas.shulok at lmco.com Thu Apr 7 17:43:11 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Thu, 07 Apr 2005 19:43:11 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi There, I'm attempting to talk RS232 between an embedded Linux box and a Windows box. Everything connects up fine, and I can send and receive a simple sequence of bytes with no problems. However, if around 5 seconds goes by without me sending something, I get the following when I attempt to send. java.io.IOException: Input/output error in writeArray Stack trace: java/lang/Throwable.()V java/lang/Throwable.(Ljava/lang/String;)V java/io/IOException.(Ljava/lang/String;)V gnu/io/RXTXPort.writeArray([BIIZ)V gnu/io/RXTXPort$SerialOutputStream.write([B)V SerialTest.main([Ljava/lang/String;)V If there interval is shorter (say 2 seconds between sends), I have no problems. On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and librxtxSerial-2.0.7pre2.so. Any ideas? Thanks, Thom -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5b23dcf/attachment-0152.html From taj at www.linux.org.uk Thu Apr 7 19:22:36 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:22:36 +0100 (BST) Subject: [Rxtx] Input/output error in writeArray In-Reply-To: References: Message-ID: On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a Windows > box. Everything connects up fine, and I can send and receive a simple > sequence of bytes with no problems. However, if around 5 seconds goes > by without me sending something, I get the following when I attempt to > send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Apr 7 19:24:59 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:24:59 +0100 (BST) Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) Message-ID: hmm. This would not work from applets would it? -- Trent Jarvi taj at www.linux.org.uk ---------- Forwarded message ---------- Date: Thu, 07 Apr 2005 16:05:53 -0400 From: Chris Gaffney To: taj at www.linux.org.uk Subject: RXTX Libraries on Classpath fix Hi, I submitted a patch for RXTX a few weeks ago to allow for loading the native libraries from the classpath. Since sending it to you I found it wasn't working on windows. I've fixed the problem and created a new patch that should replace the older one. The actual change is a one line from a String.equals() to a String.startsWith(). Thanks for a great piece of software, -Chris Gaffney Grand Valley State University -------------- next part -------------- A non-text attachment was scrubbed... Name: libraries_on_classpath_fixed.patch Type: text/x-patch Size: 5617 bytes Desc: Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5d423b8/libraries_on_classpath_fixed-0152.bin From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From thomas.shulok at lmco.com Fri Apr 8 10:38:55 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Fri, 08 Apr 2005 12:38:55 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi Trent, Thanks for the prompt response. Before diving deeper, I was wondering if there is a timeout parameter somewhere in the stack that I have not set properly. Given the nature of the failure (only fails if the line has been idle for a few seconds), it feels like some kind of timeout issue... Thanks again, Thom -----Original Message----- From: rxtx-bounces at mail.linuxgrrls.org [mailto:rxtx-bounces at mail.linuxgrrls.org] On Behalf Of Trent Jarvi Sent: Thursday, April 07, 2005 6:23 PM To: Java RXTX discussion Subject: Re: [Rxtx] Input/output error in writeArray On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a > Windows box. Everything connects up fine, and I can send and receive > a simple sequence of bytes with no problems. However, if around 5 > seconds goes by without me sending something, I get the following when > I attempt to send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at mail.linuxgrrls.org http://mail.linuxgrrls.org/mailman/listinfo/rxtx From ricardo.trindade at emation.pt Mon Apr 4 09:17:23 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Mon, 04 Apr 2005 16:17:23 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot Message-ID: <42515A83.4050907@emation.pt> Hi, I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most recent stable snapshot), and get the following exception : It looks like rxtx has been compiled with jdk 1.5. If this was indeed the case, I think there is a compilation flag that generates code that runs on older jdks. java.lang.UnsupportedClassVersionError: gnu/io/UnsupportedCommOperationException (Unsupported major.minor version 49.0) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at java.net.URLClassLoader.defineClass(URLClassLoader.java:251) at java.net.URLClassLoader.access$100(URLClassLoader.java:55) at java.net.URLClassLoader$1.run(URLClassLoader.java:194) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:187) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:141) I'm trying to run it with 1.4. thanks Ricardo From taj at www.linux.org.uk Tue Apr 5 00:48:12 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 07:48:12 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42515A83.4050907@emation.pt> References: <42515A83.4050907@emation.pt> Message-ID: On Mon, 4 Apr 2005, Ricardo Trindade wrote: > Hi, > > I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most > recent stable snapshot), and get the following exception : > > It looks like rxtx has been compiled with jdk 1.5. If this was > indeed the case, I think there is a compilation flag that generates code > that runs on older jdks. > > java.lang.UnsupportedClassVersionError: > gnu/io/UnsupportedCommOperationException (Unsupported major.minor > version 49.0) [snip] Thanks Ricardo I recompiled the jar with javac -source 1.3 -target 1.3. That should cover most of the JRE's in use today. I also compiled the rxtx 2.0 x86_64 native library which appeared to be missing. I tried looking for flags to pass gcc 4.0 to make the native libraries more backwards compatible but only found options for C++ which is not used in rxtx. I've got a list of other bugs that I'll be going through in the next few weeks but for now I just left them with the same CVS filename - no code changes. ftp://ftp.qbang.org/pub/rxtx/rxtx-2.0-CVS-20050120-bins.tar.gz ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-CVS-20050120-bins.tar.gz -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Tue Apr 5 02:24:33 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 05 Apr 2005 09:24:33 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: References: <42515A83.4050907@emation.pt> Message-ID: <42524B41.3040300@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050405/5919abbb/attachment-0153.html From taj at www.linux.org.uk Tue Apr 5 03:00:29 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 10:00:29 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42524B41.3040300@emation.pt> References: <42515A83.4050907@emation.pt> <42524B41.3040300@emation.pt> Message-ID: On Tue, 5 Apr 2005, Ricardo Trindade wrote: > Will you anounce to the list when a new release is available ? > There will be several incremental releases announced here. Once those are done, we will release 2.1.7 and 2.0.7. -- Trent Jarvi taj at www.linux.org.uk From no_spam at somewhere.com Tue Apr 5 11:55:37 2005 From: no_spam at somewhere.com (no_spam@somewhere.com) Date: Tue, 5 Apr 2005 13:55:37 -0400 Subject: [Rxtx] Closing a port from an event listener results in a deadlock Message-ID: <20050405175537.GA21747@rcog.homelinux.net> On the message I sent on March 14, does anyone had the chance to try the modification? Or was it already fixed? (I haven't searched the archive extensively) Or maybe my message got catched by some spam filters? (it made it to the list archive though) Anyway, I would appreciate some feedback (through the list) Thanks From taj at www.linux.org.uk Tue Apr 5 14:42:28 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 21:42:28 +0100 (BST) Subject: [Rxtx] Closing a port from an event listener results in a deadlock In-Reply-To: <20050405175537.GA21747@rcog.homelinux.net> References: <20050405175537.GA21747@rcog.homelinux.net> Message-ID: On Tue, 5 Apr 2005 no_spam at somewhere.com wrote: > On the message I sent on March 14, does anyone had the chance to try the > modification? > > Or was it already fixed? (I haven't searched the archive extensively) > > Or maybe my message got catched by some spam filters? (it made it to the list > archive though) > > Anyway, I would appreciate some feedback (through the list) > The patch is here http://marc.theaimsgroup.com/?l=rxtx&m=111084488820288&w=2 I have applied this patch to a local copy but will not be doing formal testing for a couple weeks. I do not try to close ports from inside the eventListenter usually so I encourage any feedback also. If there are no problems reported, I expect this will go into rxtx 2.1-7. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Wed Apr 6 08:33:42 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Wed, 06 Apr 2005 15:33:42 +0100 Subject: [Rxtx] getting RXTX version Message-ID: <4253F346.50102@emation.pt> Hi, I want to make sure my deployments have the same version of RXTX jar and native lib. I know the version of the jar can be obtained in the Version class, but how can I obtain the native version ? I know RXTX prints to the console a warning if the version is different. Is there a way to programatically know is this is the case ? I would like to log that to our app's log thanks Ricardo From taj at www.linux.org.uk Wed Apr 6 15:10:20 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 6 Apr 2005 22:10:20 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4253F346.50102@emation.pt> References: <4253F346.50102@emation.pt> Message-ID: On Wed, 6 Apr 2005, Ricardo Trindade wrote: > Hi, > > I want to make sure my deployments have the same version of RXTX jar > and native lib. > > I know the version of the jar can be obtained in the Version class, > but how can I obtain the native version ? > > I know RXTX prints to the console a warning if the version is > different. Is there a way to programatically know is this is the case ? > > I would like to log that to our app's log > There isn't a suggested way of doing that right now. We could move things around and have a static String RXTXVersion.getNativeVersion() in future releases. Is this what you expected? This is not documented in commapi at all. I just tossed that in to catch conflicts while developing. It would be nice to have access in GUI applications though. It may be possible to access RXTXCommDriver.LibVersion right now. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Thu Apr 7 02:51:00 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 09:51:00 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> Message-ID: <4254F474.7020905@emation.pt> >There isn't a suggested way of doing that right now. We could move things >around and have a static String RXTXVersion.getNativeVersion() in future >releases. Is this what you expected? > > Yes, that would be perfect. >This is not documented in commapi at all. I just tossed that in to catch >conflicts while developing. It would be nice to have access in GUI >applications though. > >It may be possible to access RXTXCommDriver.LibVersion right now. > > > I tried, and I don't think it's possible. From taj at www.linux.org.uk Thu Apr 7 03:32:04 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 7 Apr 2005 10:32:04 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4254F474.7020905@emation.pt> References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: On Thu, 7 Apr 2005, Ricardo Trindade wrote: > > >There isn't a suggested way of doing that right now. We could move things > >around and have a static String RXTXVersion.getNativeVersion() in future > >releases. Is this what you expected? > > > > > > Yes, that would be perfect. > The attached should do what you want. You will still need to catch an exception for older versions... -- Trent Jarvi taj at www.linux.org.uk -------------- next part -------------- ? public_version.patch Index: RXTXCommDriver.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXCommDriver.java,v retrieving revision 1.16.2.51 diff -u -r1.16.2.51 RXTXCommDriver.java --- RXTXCommDriver.java 12 Oct 2004 09:13:30 -0000 1.16.2.51 +++ RXTXCommDriver.java 7 Apr 2005 09:29:04 -0000 @@ -54,7 +54,7 @@ the Library. */ String JarVersion = RXTXVersion.getVersion(); - String LibVersion = nativeGetVersion(); + String LibVersion = RXTXVersion.nativeGetVersion(); if ( devel ) { System.out.println("Devel Library"); @@ -76,7 +76,6 @@ /** Get the Serial port prefixes for the running OS */ private String deviceDirectory; private String osName; - private static native String nativeGetVersion(); private native boolean registerKnownPorts(int PortType); private native boolean isPortPrefixValid(String dev); private native boolean testRead(String dev, int type); Index: RXTXVersion.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXVersion.java,v retrieving revision 1.2.2.31 diff -u -r1.2.2.31 RXTXVersion.java --- RXTXVersion.java 16 Oct 2004 16:20:35 -0000 1.2.2.31 +++ RXTXVersion.java 7 Apr 2005 09:29:04 -0000 @@ -36,6 +36,7 @@ private static String Version; static { + System.loadLibrary( "rxtxSerial" ); Version = "RXTX-2.1-7pre20"; } /** @@ -47,4 +48,5 @@ { return(Version); } + public static native String nativeGetVersion(); } Index: SerialImp.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v retrieving revision 1.46.2.181 diff -u -r1.46.2.181 SerialImp.c --- SerialImp.c 17 Oct 2004 09:48:56 -0000 1.46.2.181 +++ SerialImp.c 7 Apr 2005 09:29:07 -0000 @@ -116,6 +116,7 @@ * It will eventually be removed. * */ #define RXTXPort(foo) Java_gnu_io_RXTXPort_ ## foo +#define RXTXVersion(foo) Java_gnu_io_RXTXVersion_ ## foo #define RXTXCommDriver(foo) Java_gnu_io_RXTXCommDriver_ ## foo #if defined(__sun__) || defined(__hpux__) @@ -4001,7 +4002,7 @@ } /*---------------------------------------------------------- -RXTXCommDriver.nativeGetVersion +RXTXVersion.nativeGetVersion accept: none perform: return the current version @@ -4010,9 +4011,10 @@ comments: This is used to avoid mixing versions of the .jar and native library. First introduced in rxtx-1.5-9 + Moved from RXTXCommDriver to RXTXVersion in rxtx-2.1-7 ----------------------------------------------------------*/ -JNIEXPORT jstring JNICALL RXTXCommDriver(nativeGetVersion) (JNIEnv *env, +JNIEXPORT jstring JNICALL RXTXVersion(nativeGetVersion) (JNIEnv *env, jclass jclazz ) { return (*env)->NewStringUTF( env, "RXTX-2.1-7pre20" ); From ricardo.trindade at emation.pt Thu Apr 7 03:45:58 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 10:45:58 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: <42550156.2040908@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050407/05212451/attachment-0153.html From thomas.shulok at lmco.com Thu Apr 7 17:43:11 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Thu, 07 Apr 2005 19:43:11 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi There, I'm attempting to talk RS232 between an embedded Linux box and a Windows box. Everything connects up fine, and I can send and receive a simple sequence of bytes with no problems. However, if around 5 seconds goes by without me sending something, I get the following when I attempt to send. java.io.IOException: Input/output error in writeArray Stack trace: java/lang/Throwable.()V java/lang/Throwable.(Ljava/lang/String;)V java/io/IOException.(Ljava/lang/String;)V gnu/io/RXTXPort.writeArray([BIIZ)V gnu/io/RXTXPort$SerialOutputStream.write([B)V SerialTest.main([Ljava/lang/String;)V If there interval is shorter (say 2 seconds between sends), I have no problems. On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and librxtxSerial-2.0.7pre2.so. Any ideas? Thanks, Thom -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5b23dcf/attachment-0153.html From taj at www.linux.org.uk Thu Apr 7 19:22:36 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:22:36 +0100 (BST) Subject: [Rxtx] Input/output error in writeArray In-Reply-To: References: Message-ID: On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a Windows > box. Everything connects up fine, and I can send and receive a simple > sequence of bytes with no problems. However, if around 5 seconds goes > by without me sending something, I get the following when I attempt to > send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Apr 7 19:24:59 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:24:59 +0100 (BST) Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) Message-ID: hmm. This would not work from applets would it? -- Trent Jarvi taj at www.linux.org.uk ---------- Forwarded message ---------- Date: Thu, 07 Apr 2005 16:05:53 -0400 From: Chris Gaffney To: taj at www.linux.org.uk Subject: RXTX Libraries on Classpath fix Hi, I submitted a patch for RXTX a few weeks ago to allow for loading the native libraries from the classpath. Since sending it to you I found it wasn't working on windows. I've fixed the problem and created a new patch that should replace the older one. The actual change is a one line from a String.equals() to a String.startsWith(). Thanks for a great piece of software, -Chris Gaffney Grand Valley State University -------------- next part -------------- A non-text attachment was scrubbed... Name: libraries_on_classpath_fixed.patch Type: text/x-patch Size: 5617 bytes Desc: Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5d423b8/libraries_on_classpath_fixed-0153.bin From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From thomas.shulok at lmco.com Fri Apr 8 10:38:55 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Fri, 08 Apr 2005 12:38:55 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi Trent, Thanks for the prompt response. Before diving deeper, I was wondering if there is a timeout parameter somewhere in the stack that I have not set properly. Given the nature of the failure (only fails if the line has been idle for a few seconds), it feels like some kind of timeout issue... Thanks again, Thom -----Original Message----- From: rxtx-bounces at mail.linuxgrrls.org [mailto:rxtx-bounces at mail.linuxgrrls.org] On Behalf Of Trent Jarvi Sent: Thursday, April 07, 2005 6:23 PM To: Java RXTX discussion Subject: Re: [Rxtx] Input/output error in writeArray On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a > Windows box. Everything connects up fine, and I can send and receive > a simple sequence of bytes with no problems. However, if around 5 > seconds goes by without me sending something, I get the following when > I attempt to send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at mail.linuxgrrls.org http://mail.linuxgrrls.org/mailman/listinfo/rxtx From ricardo.trindade at emation.pt Mon Apr 4 09:17:23 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Mon, 04 Apr 2005 16:17:23 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot Message-ID: <42515A83.4050907@emation.pt> Hi, I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most recent stable snapshot), and get the following exception : It looks like rxtx has been compiled with jdk 1.5. If this was indeed the case, I think there is a compilation flag that generates code that runs on older jdks. java.lang.UnsupportedClassVersionError: gnu/io/UnsupportedCommOperationException (Unsupported major.minor version 49.0) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at java.net.URLClassLoader.defineClass(URLClassLoader.java:251) at java.net.URLClassLoader.access$100(URLClassLoader.java:55) at java.net.URLClassLoader$1.run(URLClassLoader.java:194) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:187) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:141) I'm trying to run it with 1.4. thanks Ricardo From taj at www.linux.org.uk Tue Apr 5 00:48:12 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 07:48:12 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42515A83.4050907@emation.pt> References: <42515A83.4050907@emation.pt> Message-ID: On Mon, 4 Apr 2005, Ricardo Trindade wrote: > Hi, > > I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most > recent stable snapshot), and get the following exception : > > It looks like rxtx has been compiled with jdk 1.5. If this was > indeed the case, I think there is a compilation flag that generates code > that runs on older jdks. > > java.lang.UnsupportedClassVersionError: > gnu/io/UnsupportedCommOperationException (Unsupported major.minor > version 49.0) [snip] Thanks Ricardo I recompiled the jar with javac -source 1.3 -target 1.3. That should cover most of the JRE's in use today. I also compiled the rxtx 2.0 x86_64 native library which appeared to be missing. I tried looking for flags to pass gcc 4.0 to make the native libraries more backwards compatible but only found options for C++ which is not used in rxtx. I've got a list of other bugs that I'll be going through in the next few weeks but for now I just left them with the same CVS filename - no code changes. ftp://ftp.qbang.org/pub/rxtx/rxtx-2.0-CVS-20050120-bins.tar.gz ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-CVS-20050120-bins.tar.gz -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Tue Apr 5 02:24:33 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 05 Apr 2005 09:24:33 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: References: <42515A83.4050907@emation.pt> Message-ID: <42524B41.3040300@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050405/5919abbb/attachment-0154.html From taj at www.linux.org.uk Tue Apr 5 03:00:29 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 10:00:29 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42524B41.3040300@emation.pt> References: <42515A83.4050907@emation.pt> <42524B41.3040300@emation.pt> Message-ID: On Tue, 5 Apr 2005, Ricardo Trindade wrote: > Will you anounce to the list when a new release is available ? > There will be several incremental releases announced here. Once those are done, we will release 2.1.7 and 2.0.7. -- Trent Jarvi taj at www.linux.org.uk From no_spam at somewhere.com Tue Apr 5 11:55:37 2005 From: no_spam at somewhere.com (no_spam@somewhere.com) Date: Tue, 5 Apr 2005 13:55:37 -0400 Subject: [Rxtx] Closing a port from an event listener results in a deadlock Message-ID: <20050405175537.GA21747@rcog.homelinux.net> On the message I sent on March 14, does anyone had the chance to try the modification? Or was it already fixed? (I haven't searched the archive extensively) Or maybe my message got catched by some spam filters? (it made it to the list archive though) Anyway, I would appreciate some feedback (through the list) Thanks From taj at www.linux.org.uk Tue Apr 5 14:42:28 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 21:42:28 +0100 (BST) Subject: [Rxtx] Closing a port from an event listener results in a deadlock In-Reply-To: <20050405175537.GA21747@rcog.homelinux.net> References: <20050405175537.GA21747@rcog.homelinux.net> Message-ID: On Tue, 5 Apr 2005 no_spam at somewhere.com wrote: > On the message I sent on March 14, does anyone had the chance to try the > modification? > > Or was it already fixed? (I haven't searched the archive extensively) > > Or maybe my message got catched by some spam filters? (it made it to the list > archive though) > > Anyway, I would appreciate some feedback (through the list) > The patch is here http://marc.theaimsgroup.com/?l=rxtx&m=111084488820288&w=2 I have applied this patch to a local copy but will not be doing formal testing for a couple weeks. I do not try to close ports from inside the eventListenter usually so I encourage any feedback also. If there are no problems reported, I expect this will go into rxtx 2.1-7. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Wed Apr 6 08:33:42 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Wed, 06 Apr 2005 15:33:42 +0100 Subject: [Rxtx] getting RXTX version Message-ID: <4253F346.50102@emation.pt> Hi, I want to make sure my deployments have the same version of RXTX jar and native lib. I know the version of the jar can be obtained in the Version class, but how can I obtain the native version ? I know RXTX prints to the console a warning if the version is different. Is there a way to programatically know is this is the case ? I would like to log that to our app's log thanks Ricardo From taj at www.linux.org.uk Wed Apr 6 15:10:20 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 6 Apr 2005 22:10:20 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4253F346.50102@emation.pt> References: <4253F346.50102@emation.pt> Message-ID: On Wed, 6 Apr 2005, Ricardo Trindade wrote: > Hi, > > I want to make sure my deployments have the same version of RXTX jar > and native lib. > > I know the version of the jar can be obtained in the Version class, > but how can I obtain the native version ? > > I know RXTX prints to the console a warning if the version is > different. Is there a way to programatically know is this is the case ? > > I would like to log that to our app's log > There isn't a suggested way of doing that right now. We could move things around and have a static String RXTXVersion.getNativeVersion() in future releases. Is this what you expected? This is not documented in commapi at all. I just tossed that in to catch conflicts while developing. It would be nice to have access in GUI applications though. It may be possible to access RXTXCommDriver.LibVersion right now. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Thu Apr 7 02:51:00 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 09:51:00 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> Message-ID: <4254F474.7020905@emation.pt> >There isn't a suggested way of doing that right now. We could move things >around and have a static String RXTXVersion.getNativeVersion() in future >releases. Is this what you expected? > > Yes, that would be perfect. >This is not documented in commapi at all. I just tossed that in to catch >conflicts while developing. It would be nice to have access in GUI >applications though. > >It may be possible to access RXTXCommDriver.LibVersion right now. > > > I tried, and I don't think it's possible. From taj at www.linux.org.uk Thu Apr 7 03:32:04 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 7 Apr 2005 10:32:04 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4254F474.7020905@emation.pt> References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: On Thu, 7 Apr 2005, Ricardo Trindade wrote: > > >There isn't a suggested way of doing that right now. We could move things > >around and have a static String RXTXVersion.getNativeVersion() in future > >releases. Is this what you expected? > > > > > > Yes, that would be perfect. > The attached should do what you want. You will still need to catch an exception for older versions... -- Trent Jarvi taj at www.linux.org.uk -------------- next part -------------- ? public_version.patch Index: RXTXCommDriver.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXCommDriver.java,v retrieving revision 1.16.2.51 diff -u -r1.16.2.51 RXTXCommDriver.java --- RXTXCommDriver.java 12 Oct 2004 09:13:30 -0000 1.16.2.51 +++ RXTXCommDriver.java 7 Apr 2005 09:29:04 -0000 @@ -54,7 +54,7 @@ the Library. */ String JarVersion = RXTXVersion.getVersion(); - String LibVersion = nativeGetVersion(); + String LibVersion = RXTXVersion.nativeGetVersion(); if ( devel ) { System.out.println("Devel Library"); @@ -76,7 +76,6 @@ /** Get the Serial port prefixes for the running OS */ private String deviceDirectory; private String osName; - private static native String nativeGetVersion(); private native boolean registerKnownPorts(int PortType); private native boolean isPortPrefixValid(String dev); private native boolean testRead(String dev, int type); Index: RXTXVersion.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXVersion.java,v retrieving revision 1.2.2.31 diff -u -r1.2.2.31 RXTXVersion.java --- RXTXVersion.java 16 Oct 2004 16:20:35 -0000 1.2.2.31 +++ RXTXVersion.java 7 Apr 2005 09:29:04 -0000 @@ -36,6 +36,7 @@ private static String Version; static { + System.loadLibrary( "rxtxSerial" ); Version = "RXTX-2.1-7pre20"; } /** @@ -47,4 +48,5 @@ { return(Version); } + public static native String nativeGetVersion(); } Index: SerialImp.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v retrieving revision 1.46.2.181 diff -u -r1.46.2.181 SerialImp.c --- SerialImp.c 17 Oct 2004 09:48:56 -0000 1.46.2.181 +++ SerialImp.c 7 Apr 2005 09:29:07 -0000 @@ -116,6 +116,7 @@ * It will eventually be removed. * */ #define RXTXPort(foo) Java_gnu_io_RXTXPort_ ## foo +#define RXTXVersion(foo) Java_gnu_io_RXTXVersion_ ## foo #define RXTXCommDriver(foo) Java_gnu_io_RXTXCommDriver_ ## foo #if defined(__sun__) || defined(__hpux__) @@ -4001,7 +4002,7 @@ } /*---------------------------------------------------------- -RXTXCommDriver.nativeGetVersion +RXTXVersion.nativeGetVersion accept: none perform: return the current version @@ -4010,9 +4011,10 @@ comments: This is used to avoid mixing versions of the .jar and native library. First introduced in rxtx-1.5-9 + Moved from RXTXCommDriver to RXTXVersion in rxtx-2.1-7 ----------------------------------------------------------*/ -JNIEXPORT jstring JNICALL RXTXCommDriver(nativeGetVersion) (JNIEnv *env, +JNIEXPORT jstring JNICALL RXTXVersion(nativeGetVersion) (JNIEnv *env, jclass jclazz ) { return (*env)->NewStringUTF( env, "RXTX-2.1-7pre20" ); From ricardo.trindade at emation.pt Thu Apr 7 03:45:58 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 10:45:58 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: <42550156.2040908@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050407/05212451/attachment-0154.html From thomas.shulok at lmco.com Thu Apr 7 17:43:11 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Thu, 07 Apr 2005 19:43:11 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi There, I'm attempting to talk RS232 between an embedded Linux box and a Windows box. Everything connects up fine, and I can send and receive a simple sequence of bytes with no problems. However, if around 5 seconds goes by without me sending something, I get the following when I attempt to send. java.io.IOException: Input/output error in writeArray Stack trace: java/lang/Throwable.()V java/lang/Throwable.(Ljava/lang/String;)V java/io/IOException.(Ljava/lang/String;)V gnu/io/RXTXPort.writeArray([BIIZ)V gnu/io/RXTXPort$SerialOutputStream.write([B)V SerialTest.main([Ljava/lang/String;)V If there interval is shorter (say 2 seconds between sends), I have no problems. On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and librxtxSerial-2.0.7pre2.so. Any ideas? Thanks, Thom -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5b23dcf/attachment-0154.html From taj at www.linux.org.uk Thu Apr 7 19:22:36 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:22:36 +0100 (BST) Subject: [Rxtx] Input/output error in writeArray In-Reply-To: References: Message-ID: On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a Windows > box. Everything connects up fine, and I can send and receive a simple > sequence of bytes with no problems. However, if around 5 seconds goes > by without me sending something, I get the following when I attempt to > send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Apr 7 19:24:59 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:24:59 +0100 (BST) Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) Message-ID: hmm. This would not work from applets would it? -- Trent Jarvi taj at www.linux.org.uk ---------- Forwarded message ---------- Date: Thu, 07 Apr 2005 16:05:53 -0400 From: Chris Gaffney To: taj at www.linux.org.uk Subject: RXTX Libraries on Classpath fix Hi, I submitted a patch for RXTX a few weeks ago to allow for loading the native libraries from the classpath. Since sending it to you I found it wasn't working on windows. I've fixed the problem and created a new patch that should replace the older one. The actual change is a one line from a String.equals() to a String.startsWith(). Thanks for a great piece of software, -Chris Gaffney Grand Valley State University -------------- next part -------------- A non-text attachment was scrubbed... Name: libraries_on_classpath_fixed.patch Type: text/x-patch Size: 5617 bytes Desc: Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5d423b8/libraries_on_classpath_fixed-0154.bin From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From thomas.shulok at lmco.com Fri Apr 8 10:38:55 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Fri, 08 Apr 2005 12:38:55 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi Trent, Thanks for the prompt response. Before diving deeper, I was wondering if there is a timeout parameter somewhere in the stack that I have not set properly. Given the nature of the failure (only fails if the line has been idle for a few seconds), it feels like some kind of timeout issue... Thanks again, Thom -----Original Message----- From: rxtx-bounces at mail.linuxgrrls.org [mailto:rxtx-bounces at mail.linuxgrrls.org] On Behalf Of Trent Jarvi Sent: Thursday, April 07, 2005 6:23 PM To: Java RXTX discussion Subject: Re: [Rxtx] Input/output error in writeArray On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a > Windows box. Everything connects up fine, and I can send and receive > a simple sequence of bytes with no problems. However, if around 5 > seconds goes by without me sending something, I get the following when > I attempt to send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at mail.linuxgrrls.org http://mail.linuxgrrls.org/mailman/listinfo/rxtx From ricardo.trindade at emation.pt Mon Apr 4 09:17:23 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Mon, 04 Apr 2005 16:17:23 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot Message-ID: <42515A83.4050907@emation.pt> Hi, I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most recent stable snapshot), and get the following exception : It looks like rxtx has been compiled with jdk 1.5. If this was indeed the case, I think there is a compilation flag that generates code that runs on older jdks. java.lang.UnsupportedClassVersionError: gnu/io/UnsupportedCommOperationException (Unsupported major.minor version 49.0) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at java.net.URLClassLoader.defineClass(URLClassLoader.java:251) at java.net.URLClassLoader.access$100(URLClassLoader.java:55) at java.net.URLClassLoader$1.run(URLClassLoader.java:194) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:187) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:141) I'm trying to run it with 1.4. thanks Ricardo From taj at www.linux.org.uk Tue Apr 5 00:48:12 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 07:48:12 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42515A83.4050907@emation.pt> References: <42515A83.4050907@emation.pt> Message-ID: On Mon, 4 Apr 2005, Ricardo Trindade wrote: > Hi, > > I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most > recent stable snapshot), and get the following exception : > > It looks like rxtx has been compiled with jdk 1.5. If this was > indeed the case, I think there is a compilation flag that generates code > that runs on older jdks. > > java.lang.UnsupportedClassVersionError: > gnu/io/UnsupportedCommOperationException (Unsupported major.minor > version 49.0) [snip] Thanks Ricardo I recompiled the jar with javac -source 1.3 -target 1.3. That should cover most of the JRE's in use today. I also compiled the rxtx 2.0 x86_64 native library which appeared to be missing. I tried looking for flags to pass gcc 4.0 to make the native libraries more backwards compatible but only found options for C++ which is not used in rxtx. I've got a list of other bugs that I'll be going through in the next few weeks but for now I just left them with the same CVS filename - no code changes. ftp://ftp.qbang.org/pub/rxtx/rxtx-2.0-CVS-20050120-bins.tar.gz ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-CVS-20050120-bins.tar.gz -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Tue Apr 5 02:24:33 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 05 Apr 2005 09:24:33 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: References: <42515A83.4050907@emation.pt> Message-ID: <42524B41.3040300@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050405/5919abbb/attachment-0155.html From taj at www.linux.org.uk Tue Apr 5 03:00:29 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 10:00:29 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42524B41.3040300@emation.pt> References: <42515A83.4050907@emation.pt> <42524B41.3040300@emation.pt> Message-ID: On Tue, 5 Apr 2005, Ricardo Trindade wrote: > Will you anounce to the list when a new release is available ? > There will be several incremental releases announced here. Once those are done, we will release 2.1.7 and 2.0.7. -- Trent Jarvi taj at www.linux.org.uk From no_spam at somewhere.com Tue Apr 5 11:55:37 2005 From: no_spam at somewhere.com (no_spam@somewhere.com) Date: Tue, 5 Apr 2005 13:55:37 -0400 Subject: [Rxtx] Closing a port from an event listener results in a deadlock Message-ID: <20050405175537.GA21747@rcog.homelinux.net> On the message I sent on March 14, does anyone had the chance to try the modification? Or was it already fixed? (I haven't searched the archive extensively) Or maybe my message got catched by some spam filters? (it made it to the list archive though) Anyway, I would appreciate some feedback (through the list) Thanks From taj at www.linux.org.uk Tue Apr 5 14:42:28 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 21:42:28 +0100 (BST) Subject: [Rxtx] Closing a port from an event listener results in a deadlock In-Reply-To: <20050405175537.GA21747@rcog.homelinux.net> References: <20050405175537.GA21747@rcog.homelinux.net> Message-ID: On Tue, 5 Apr 2005 no_spam at somewhere.com wrote: > On the message I sent on March 14, does anyone had the chance to try the > modification? > > Or was it already fixed? (I haven't searched the archive extensively) > > Or maybe my message got catched by some spam filters? (it made it to the list > archive though) > > Anyway, I would appreciate some feedback (through the list) > The patch is here http://marc.theaimsgroup.com/?l=rxtx&m=111084488820288&w=2 I have applied this patch to a local copy but will not be doing formal testing for a couple weeks. I do not try to close ports from inside the eventListenter usually so I encourage any feedback also. If there are no problems reported, I expect this will go into rxtx 2.1-7. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Wed Apr 6 08:33:42 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Wed, 06 Apr 2005 15:33:42 +0100 Subject: [Rxtx] getting RXTX version Message-ID: <4253F346.50102@emation.pt> Hi, I want to make sure my deployments have the same version of RXTX jar and native lib. I know the version of the jar can be obtained in the Version class, but how can I obtain the native version ? I know RXTX prints to the console a warning if the version is different. Is there a way to programatically know is this is the case ? I would like to log that to our app's log thanks Ricardo From taj at www.linux.org.uk Wed Apr 6 15:10:20 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 6 Apr 2005 22:10:20 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4253F346.50102@emation.pt> References: <4253F346.50102@emation.pt> Message-ID: On Wed, 6 Apr 2005, Ricardo Trindade wrote: > Hi, > > I want to make sure my deployments have the same version of RXTX jar > and native lib. > > I know the version of the jar can be obtained in the Version class, > but how can I obtain the native version ? > > I know RXTX prints to the console a warning if the version is > different. Is there a way to programatically know is this is the case ? > > I would like to log that to our app's log > There isn't a suggested way of doing that right now. We could move things around and have a static String RXTXVersion.getNativeVersion() in future releases. Is this what you expected? This is not documented in commapi at all. I just tossed that in to catch conflicts while developing. It would be nice to have access in GUI applications though. It may be possible to access RXTXCommDriver.LibVersion right now. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Thu Apr 7 02:51:00 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 09:51:00 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> Message-ID: <4254F474.7020905@emation.pt> >There isn't a suggested way of doing that right now. We could move things >around and have a static String RXTXVersion.getNativeVersion() in future >releases. Is this what you expected? > > Yes, that would be perfect. >This is not documented in commapi at all. I just tossed that in to catch >conflicts while developing. It would be nice to have access in GUI >applications though. > >It may be possible to access RXTXCommDriver.LibVersion right now. > > > I tried, and I don't think it's possible. From taj at www.linux.org.uk Thu Apr 7 03:32:04 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 7 Apr 2005 10:32:04 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4254F474.7020905@emation.pt> References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: On Thu, 7 Apr 2005, Ricardo Trindade wrote: > > >There isn't a suggested way of doing that right now. We could move things > >around and have a static String RXTXVersion.getNativeVersion() in future > >releases. Is this what you expected? > > > > > > Yes, that would be perfect. > The attached should do what you want. You will still need to catch an exception for older versions... -- Trent Jarvi taj at www.linux.org.uk -------------- next part -------------- ? public_version.patch Index: RXTXCommDriver.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXCommDriver.java,v retrieving revision 1.16.2.51 diff -u -r1.16.2.51 RXTXCommDriver.java --- RXTXCommDriver.java 12 Oct 2004 09:13:30 -0000 1.16.2.51 +++ RXTXCommDriver.java 7 Apr 2005 09:29:04 -0000 @@ -54,7 +54,7 @@ the Library. */ String JarVersion = RXTXVersion.getVersion(); - String LibVersion = nativeGetVersion(); + String LibVersion = RXTXVersion.nativeGetVersion(); if ( devel ) { System.out.println("Devel Library"); @@ -76,7 +76,6 @@ /** Get the Serial port prefixes for the running OS */ private String deviceDirectory; private String osName; - private static native String nativeGetVersion(); private native boolean registerKnownPorts(int PortType); private native boolean isPortPrefixValid(String dev); private native boolean testRead(String dev, int type); Index: RXTXVersion.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXVersion.java,v retrieving revision 1.2.2.31 diff -u -r1.2.2.31 RXTXVersion.java --- RXTXVersion.java 16 Oct 2004 16:20:35 -0000 1.2.2.31 +++ RXTXVersion.java 7 Apr 2005 09:29:04 -0000 @@ -36,6 +36,7 @@ private static String Version; static { + System.loadLibrary( "rxtxSerial" ); Version = "RXTX-2.1-7pre20"; } /** @@ -47,4 +48,5 @@ { return(Version); } + public static native String nativeGetVersion(); } Index: SerialImp.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v retrieving revision 1.46.2.181 diff -u -r1.46.2.181 SerialImp.c --- SerialImp.c 17 Oct 2004 09:48:56 -0000 1.46.2.181 +++ SerialImp.c 7 Apr 2005 09:29:07 -0000 @@ -116,6 +116,7 @@ * It will eventually be removed. * */ #define RXTXPort(foo) Java_gnu_io_RXTXPort_ ## foo +#define RXTXVersion(foo) Java_gnu_io_RXTXVersion_ ## foo #define RXTXCommDriver(foo) Java_gnu_io_RXTXCommDriver_ ## foo #if defined(__sun__) || defined(__hpux__) @@ -4001,7 +4002,7 @@ } /*---------------------------------------------------------- -RXTXCommDriver.nativeGetVersion +RXTXVersion.nativeGetVersion accept: none perform: return the current version @@ -4010,9 +4011,10 @@ comments: This is used to avoid mixing versions of the .jar and native library. First introduced in rxtx-1.5-9 + Moved from RXTXCommDriver to RXTXVersion in rxtx-2.1-7 ----------------------------------------------------------*/ -JNIEXPORT jstring JNICALL RXTXCommDriver(nativeGetVersion) (JNIEnv *env, +JNIEXPORT jstring JNICALL RXTXVersion(nativeGetVersion) (JNIEnv *env, jclass jclazz ) { return (*env)->NewStringUTF( env, "RXTX-2.1-7pre20" ); From ricardo.trindade at emation.pt Thu Apr 7 03:45:58 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 10:45:58 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: <42550156.2040908@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050407/05212451/attachment-0155.html From thomas.shulok at lmco.com Thu Apr 7 17:43:11 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Thu, 07 Apr 2005 19:43:11 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi There, I'm attempting to talk RS232 between an embedded Linux box and a Windows box. Everything connects up fine, and I can send and receive a simple sequence of bytes with no problems. However, if around 5 seconds goes by without me sending something, I get the following when I attempt to send. java.io.IOException: Input/output error in writeArray Stack trace: java/lang/Throwable.()V java/lang/Throwable.(Ljava/lang/String;)V java/io/IOException.(Ljava/lang/String;)V gnu/io/RXTXPort.writeArray([BIIZ)V gnu/io/RXTXPort$SerialOutputStream.write([B)V SerialTest.main([Ljava/lang/String;)V If there interval is shorter (say 2 seconds between sends), I have no problems. On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and librxtxSerial-2.0.7pre2.so. Any ideas? Thanks, Thom -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5b23dcf/attachment-0155.html From taj at www.linux.org.uk Thu Apr 7 19:22:36 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:22:36 +0100 (BST) Subject: [Rxtx] Input/output error in writeArray In-Reply-To: References: Message-ID: On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a Windows > box. Everything connects up fine, and I can send and receive a simple > sequence of bytes with no problems. However, if around 5 seconds goes > by without me sending something, I get the following when I attempt to > send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Apr 7 19:24:59 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:24:59 +0100 (BST) Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) Message-ID: hmm. This would not work from applets would it? -- Trent Jarvi taj at www.linux.org.uk ---------- Forwarded message ---------- Date: Thu, 07 Apr 2005 16:05:53 -0400 From: Chris Gaffney To: taj at www.linux.org.uk Subject: RXTX Libraries on Classpath fix Hi, I submitted a patch for RXTX a few weeks ago to allow for loading the native libraries from the classpath. Since sending it to you I found it wasn't working on windows. I've fixed the problem and created a new patch that should replace the older one. The actual change is a one line from a String.equals() to a String.startsWith(). Thanks for a great piece of software, -Chris Gaffney Grand Valley State University -------------- next part -------------- A non-text attachment was scrubbed... Name: libraries_on_classpath_fixed.patch Type: text/x-patch Size: 5617 bytes Desc: Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5d423b8/libraries_on_classpath_fixed-0155.bin From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From thomas.shulok at lmco.com Fri Apr 8 10:38:55 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Fri, 08 Apr 2005 12:38:55 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi Trent, Thanks for the prompt response. Before diving deeper, I was wondering if there is a timeout parameter somewhere in the stack that I have not set properly. Given the nature of the failure (only fails if the line has been idle for a few seconds), it feels like some kind of timeout issue... Thanks again, Thom -----Original Message----- From: rxtx-bounces at mail.linuxgrrls.org [mailto:rxtx-bounces at mail.linuxgrrls.org] On Behalf Of Trent Jarvi Sent: Thursday, April 07, 2005 6:23 PM To: Java RXTX discussion Subject: Re: [Rxtx] Input/output error in writeArray On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a > Windows box. Everything connects up fine, and I can send and receive > a simple sequence of bytes with no problems. However, if around 5 > seconds goes by without me sending something, I get the following when > I attempt to send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at mail.linuxgrrls.org http://mail.linuxgrrls.org/mailman/listinfo/rxtx From ricardo.trindade at emation.pt Mon Apr 4 09:17:23 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Mon, 04 Apr 2005 16:17:23 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot Message-ID: <42515A83.4050907@emation.pt> Hi, I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most recent stable snapshot), and get the following exception : It looks like rxtx has been compiled with jdk 1.5. If this was indeed the case, I think there is a compilation flag that generates code that runs on older jdks. java.lang.UnsupportedClassVersionError: gnu/io/UnsupportedCommOperationException (Unsupported major.minor version 49.0) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at java.net.URLClassLoader.defineClass(URLClassLoader.java:251) at java.net.URLClassLoader.access$100(URLClassLoader.java:55) at java.net.URLClassLoader$1.run(URLClassLoader.java:194) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:187) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:141) I'm trying to run it with 1.4. thanks Ricardo From taj at www.linux.org.uk Tue Apr 5 00:48:12 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 07:48:12 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42515A83.4050907@emation.pt> References: <42515A83.4050907@emation.pt> Message-ID: On Mon, 4 Apr 2005, Ricardo Trindade wrote: > Hi, > > I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most > recent stable snapshot), and get the following exception : > > It looks like rxtx has been compiled with jdk 1.5. If this was > indeed the case, I think there is a compilation flag that generates code > that runs on older jdks. > > java.lang.UnsupportedClassVersionError: > gnu/io/UnsupportedCommOperationException (Unsupported major.minor > version 49.0) [snip] Thanks Ricardo I recompiled the jar with javac -source 1.3 -target 1.3. That should cover most of the JRE's in use today. I also compiled the rxtx 2.0 x86_64 native library which appeared to be missing. I tried looking for flags to pass gcc 4.0 to make the native libraries more backwards compatible but only found options for C++ which is not used in rxtx. I've got a list of other bugs that I'll be going through in the next few weeks but for now I just left them with the same CVS filename - no code changes. ftp://ftp.qbang.org/pub/rxtx/rxtx-2.0-CVS-20050120-bins.tar.gz ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-CVS-20050120-bins.tar.gz -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Tue Apr 5 02:24:33 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 05 Apr 2005 09:24:33 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: References: <42515A83.4050907@emation.pt> Message-ID: <42524B41.3040300@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050405/5919abbb/attachment-0156.html From taj at www.linux.org.uk Tue Apr 5 03:00:29 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 10:00:29 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42524B41.3040300@emation.pt> References: <42515A83.4050907@emation.pt> <42524B41.3040300@emation.pt> Message-ID: On Tue, 5 Apr 2005, Ricardo Trindade wrote: > Will you anounce to the list when a new release is available ? > There will be several incremental releases announced here. Once those are done, we will release 2.1.7 and 2.0.7. -- Trent Jarvi taj at www.linux.org.uk From no_spam at somewhere.com Tue Apr 5 11:55:37 2005 From: no_spam at somewhere.com (no_spam@somewhere.com) Date: Tue, 5 Apr 2005 13:55:37 -0400 Subject: [Rxtx] Closing a port from an event listener results in a deadlock Message-ID: <20050405175537.GA21747@rcog.homelinux.net> On the message I sent on March 14, does anyone had the chance to try the modification? Or was it already fixed? (I haven't searched the archive extensively) Or maybe my message got catched by some spam filters? (it made it to the list archive though) Anyway, I would appreciate some feedback (through the list) Thanks From taj at www.linux.org.uk Tue Apr 5 14:42:28 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 21:42:28 +0100 (BST) Subject: [Rxtx] Closing a port from an event listener results in a deadlock In-Reply-To: <20050405175537.GA21747@rcog.homelinux.net> References: <20050405175537.GA21747@rcog.homelinux.net> Message-ID: On Tue, 5 Apr 2005 no_spam at somewhere.com wrote: > On the message I sent on March 14, does anyone had the chance to try the > modification? > > Or was it already fixed? (I haven't searched the archive extensively) > > Or maybe my message got catched by some spam filters? (it made it to the list > archive though) > > Anyway, I would appreciate some feedback (through the list) > The patch is here http://marc.theaimsgroup.com/?l=rxtx&m=111084488820288&w=2 I have applied this patch to a local copy but will not be doing formal testing for a couple weeks. I do not try to close ports from inside the eventListenter usually so I encourage any feedback also. If there are no problems reported, I expect this will go into rxtx 2.1-7. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Wed Apr 6 08:33:42 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Wed, 06 Apr 2005 15:33:42 +0100 Subject: [Rxtx] getting RXTX version Message-ID: <4253F346.50102@emation.pt> Hi, I want to make sure my deployments have the same version of RXTX jar and native lib. I know the version of the jar can be obtained in the Version class, but how can I obtain the native version ? I know RXTX prints to the console a warning if the version is different. Is there a way to programatically know is this is the case ? I would like to log that to our app's log thanks Ricardo From taj at www.linux.org.uk Wed Apr 6 15:10:20 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 6 Apr 2005 22:10:20 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4253F346.50102@emation.pt> References: <4253F346.50102@emation.pt> Message-ID: On Wed, 6 Apr 2005, Ricardo Trindade wrote: > Hi, > > I want to make sure my deployments have the same version of RXTX jar > and native lib. > > I know the version of the jar can be obtained in the Version class, > but how can I obtain the native version ? > > I know RXTX prints to the console a warning if the version is > different. Is there a way to programatically know is this is the case ? > > I would like to log that to our app's log > There isn't a suggested way of doing that right now. We could move things around and have a static String RXTXVersion.getNativeVersion() in future releases. Is this what you expected? This is not documented in commapi at all. I just tossed that in to catch conflicts while developing. It would be nice to have access in GUI applications though. It may be possible to access RXTXCommDriver.LibVersion right now. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Thu Apr 7 02:51:00 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 09:51:00 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> Message-ID: <4254F474.7020905@emation.pt> >There isn't a suggested way of doing that right now. We could move things >around and have a static String RXTXVersion.getNativeVersion() in future >releases. Is this what you expected? > > Yes, that would be perfect. >This is not documented in commapi at all. I just tossed that in to catch >conflicts while developing. It would be nice to have access in GUI >applications though. > >It may be possible to access RXTXCommDriver.LibVersion right now. > > > I tried, and I don't think it's possible. From taj at www.linux.org.uk Thu Apr 7 03:32:04 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 7 Apr 2005 10:32:04 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4254F474.7020905@emation.pt> References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: On Thu, 7 Apr 2005, Ricardo Trindade wrote: > > >There isn't a suggested way of doing that right now. We could move things > >around and have a static String RXTXVersion.getNativeVersion() in future > >releases. Is this what you expected? > > > > > > Yes, that would be perfect. > The attached should do what you want. You will still need to catch an exception for older versions... -- Trent Jarvi taj at www.linux.org.uk -------------- next part -------------- ? public_version.patch Index: RXTXCommDriver.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXCommDriver.java,v retrieving revision 1.16.2.51 diff -u -r1.16.2.51 RXTXCommDriver.java --- RXTXCommDriver.java 12 Oct 2004 09:13:30 -0000 1.16.2.51 +++ RXTXCommDriver.java 7 Apr 2005 09:29:04 -0000 @@ -54,7 +54,7 @@ the Library. */ String JarVersion = RXTXVersion.getVersion(); - String LibVersion = nativeGetVersion(); + String LibVersion = RXTXVersion.nativeGetVersion(); if ( devel ) { System.out.println("Devel Library"); @@ -76,7 +76,6 @@ /** Get the Serial port prefixes for the running OS */ private String deviceDirectory; private String osName; - private static native String nativeGetVersion(); private native boolean registerKnownPorts(int PortType); private native boolean isPortPrefixValid(String dev); private native boolean testRead(String dev, int type); Index: RXTXVersion.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXVersion.java,v retrieving revision 1.2.2.31 diff -u -r1.2.2.31 RXTXVersion.java --- RXTXVersion.java 16 Oct 2004 16:20:35 -0000 1.2.2.31 +++ RXTXVersion.java 7 Apr 2005 09:29:04 -0000 @@ -36,6 +36,7 @@ private static String Version; static { + System.loadLibrary( "rxtxSerial" ); Version = "RXTX-2.1-7pre20"; } /** @@ -47,4 +48,5 @@ { return(Version); } + public static native String nativeGetVersion(); } Index: SerialImp.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v retrieving revision 1.46.2.181 diff -u -r1.46.2.181 SerialImp.c --- SerialImp.c 17 Oct 2004 09:48:56 -0000 1.46.2.181 +++ SerialImp.c 7 Apr 2005 09:29:07 -0000 @@ -116,6 +116,7 @@ * It will eventually be removed. * */ #define RXTXPort(foo) Java_gnu_io_RXTXPort_ ## foo +#define RXTXVersion(foo) Java_gnu_io_RXTXVersion_ ## foo #define RXTXCommDriver(foo) Java_gnu_io_RXTXCommDriver_ ## foo #if defined(__sun__) || defined(__hpux__) @@ -4001,7 +4002,7 @@ } /*---------------------------------------------------------- -RXTXCommDriver.nativeGetVersion +RXTXVersion.nativeGetVersion accept: none perform: return the current version @@ -4010,9 +4011,10 @@ comments: This is used to avoid mixing versions of the .jar and native library. First introduced in rxtx-1.5-9 + Moved from RXTXCommDriver to RXTXVersion in rxtx-2.1-7 ----------------------------------------------------------*/ -JNIEXPORT jstring JNICALL RXTXCommDriver(nativeGetVersion) (JNIEnv *env, +JNIEXPORT jstring JNICALL RXTXVersion(nativeGetVersion) (JNIEnv *env, jclass jclazz ) { return (*env)->NewStringUTF( env, "RXTX-2.1-7pre20" ); From ricardo.trindade at emation.pt Thu Apr 7 03:45:58 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 10:45:58 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: <42550156.2040908@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050407/05212451/attachment-0156.html From thomas.shulok at lmco.com Thu Apr 7 17:43:11 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Thu, 07 Apr 2005 19:43:11 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi There, I'm attempting to talk RS232 between an embedded Linux box and a Windows box. Everything connects up fine, and I can send and receive a simple sequence of bytes with no problems. However, if around 5 seconds goes by without me sending something, I get the following when I attempt to send. java.io.IOException: Input/output error in writeArray Stack trace: java/lang/Throwable.()V java/lang/Throwable.(Ljava/lang/String;)V java/io/IOException.(Ljava/lang/String;)V gnu/io/RXTXPort.writeArray([BIIZ)V gnu/io/RXTXPort$SerialOutputStream.write([B)V SerialTest.main([Ljava/lang/String;)V If there interval is shorter (say 2 seconds between sends), I have no problems. On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and librxtxSerial-2.0.7pre2.so. Any ideas? Thanks, Thom -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5b23dcf/attachment-0156.html From taj at www.linux.org.uk Thu Apr 7 19:22:36 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:22:36 +0100 (BST) Subject: [Rxtx] Input/output error in writeArray In-Reply-To: References: Message-ID: On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a Windows > box. Everything connects up fine, and I can send and receive a simple > sequence of bytes with no problems. However, if around 5 seconds goes > by without me sending something, I get the following when I attempt to > send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Apr 7 19:24:59 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:24:59 +0100 (BST) Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) Message-ID: hmm. This would not work from applets would it? -- Trent Jarvi taj at www.linux.org.uk ---------- Forwarded message ---------- Date: Thu, 07 Apr 2005 16:05:53 -0400 From: Chris Gaffney To: taj at www.linux.org.uk Subject: RXTX Libraries on Classpath fix Hi, I submitted a patch for RXTX a few weeks ago to allow for loading the native libraries from the classpath. Since sending it to you I found it wasn't working on windows. I've fixed the problem and created a new patch that should replace the older one. The actual change is a one line from a String.equals() to a String.startsWith(). Thanks for a great piece of software, -Chris Gaffney Grand Valley State University -------------- next part -------------- A non-text attachment was scrubbed... Name: libraries_on_classpath_fixed.patch Type: text/x-patch Size: 5617 bytes Desc: Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5d423b8/libraries_on_classpath_fixed-0156.bin From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From thomas.shulok at lmco.com Fri Apr 8 10:38:55 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Fri, 08 Apr 2005 12:38:55 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi Trent, Thanks for the prompt response. Before diving deeper, I was wondering if there is a timeout parameter somewhere in the stack that I have not set properly. Given the nature of the failure (only fails if the line has been idle for a few seconds), it feels like some kind of timeout issue... Thanks again, Thom -----Original Message----- From: rxtx-bounces at mail.linuxgrrls.org [mailto:rxtx-bounces at mail.linuxgrrls.org] On Behalf Of Trent Jarvi Sent: Thursday, April 07, 2005 6:23 PM To: Java RXTX discussion Subject: Re: [Rxtx] Input/output error in writeArray On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a > Windows box. Everything connects up fine, and I can send and receive > a simple sequence of bytes with no problems. However, if around 5 > seconds goes by without me sending something, I get the following when > I attempt to send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at mail.linuxgrrls.org http://mail.linuxgrrls.org/mailman/listinfo/rxtx From ricardo.trindade at emation.pt Mon Apr 4 09:17:23 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Mon, 04 Apr 2005 16:17:23 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot Message-ID: <42515A83.4050907@emation.pt> Hi, I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most recent stable snapshot), and get the following exception : It looks like rxtx has been compiled with jdk 1.5. If this was indeed the case, I think there is a compilation flag that generates code that runs on older jdks. java.lang.UnsupportedClassVersionError: gnu/io/UnsupportedCommOperationException (Unsupported major.minor version 49.0) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at java.net.URLClassLoader.defineClass(URLClassLoader.java:251) at java.net.URLClassLoader.access$100(URLClassLoader.java:55) at java.net.URLClassLoader$1.run(URLClassLoader.java:194) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:187) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:141) I'm trying to run it with 1.4. thanks Ricardo From taj at www.linux.org.uk Tue Apr 5 00:48:12 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 07:48:12 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42515A83.4050907@emation.pt> References: <42515A83.4050907@emation.pt> Message-ID: On Mon, 4 Apr 2005, Ricardo Trindade wrote: > Hi, > > I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most > recent stable snapshot), and get the following exception : > > It looks like rxtx has been compiled with jdk 1.5. If this was > indeed the case, I think there is a compilation flag that generates code > that runs on older jdks. > > java.lang.UnsupportedClassVersionError: > gnu/io/UnsupportedCommOperationException (Unsupported major.minor > version 49.0) [snip] Thanks Ricardo I recompiled the jar with javac -source 1.3 -target 1.3. That should cover most of the JRE's in use today. I also compiled the rxtx 2.0 x86_64 native library which appeared to be missing. I tried looking for flags to pass gcc 4.0 to make the native libraries more backwards compatible but only found options for C++ which is not used in rxtx. I've got a list of other bugs that I'll be going through in the next few weeks but for now I just left them with the same CVS filename - no code changes. ftp://ftp.qbang.org/pub/rxtx/rxtx-2.0-CVS-20050120-bins.tar.gz ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-CVS-20050120-bins.tar.gz -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Tue Apr 5 02:24:33 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 05 Apr 2005 09:24:33 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: References: <42515A83.4050907@emation.pt> Message-ID: <42524B41.3040300@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050405/5919abbb/attachment-0157.html From taj at www.linux.org.uk Tue Apr 5 03:00:29 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 10:00:29 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42524B41.3040300@emation.pt> References: <42515A83.4050907@emation.pt> <42524B41.3040300@emation.pt> Message-ID: On Tue, 5 Apr 2005, Ricardo Trindade wrote: > Will you anounce to the list when a new release is available ? > There will be several incremental releases announced here. Once those are done, we will release 2.1.7 and 2.0.7. -- Trent Jarvi taj at www.linux.org.uk From no_spam at somewhere.com Tue Apr 5 11:55:37 2005 From: no_spam at somewhere.com (no_spam@somewhere.com) Date: Tue, 5 Apr 2005 13:55:37 -0400 Subject: [Rxtx] Closing a port from an event listener results in a deadlock Message-ID: <20050405175537.GA21747@rcog.homelinux.net> On the message I sent on March 14, does anyone had the chance to try the modification? Or was it already fixed? (I haven't searched the archive extensively) Or maybe my message got catched by some spam filters? (it made it to the list archive though) Anyway, I would appreciate some feedback (through the list) Thanks From taj at www.linux.org.uk Tue Apr 5 14:42:28 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 21:42:28 +0100 (BST) Subject: [Rxtx] Closing a port from an event listener results in a deadlock In-Reply-To: <20050405175537.GA21747@rcog.homelinux.net> References: <20050405175537.GA21747@rcog.homelinux.net> Message-ID: On Tue, 5 Apr 2005 no_spam at somewhere.com wrote: > On the message I sent on March 14, does anyone had the chance to try the > modification? > > Or was it already fixed? (I haven't searched the archive extensively) > > Or maybe my message got catched by some spam filters? (it made it to the list > archive though) > > Anyway, I would appreciate some feedback (through the list) > The patch is here http://marc.theaimsgroup.com/?l=rxtx&m=111084488820288&w=2 I have applied this patch to a local copy but will not be doing formal testing for a couple weeks. I do not try to close ports from inside the eventListenter usually so I encourage any feedback also. If there are no problems reported, I expect this will go into rxtx 2.1-7. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Wed Apr 6 08:33:42 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Wed, 06 Apr 2005 15:33:42 +0100 Subject: [Rxtx] getting RXTX version Message-ID: <4253F346.50102@emation.pt> Hi, I want to make sure my deployments have the same version of RXTX jar and native lib. I know the version of the jar can be obtained in the Version class, but how can I obtain the native version ? I know RXTX prints to the console a warning if the version is different. Is there a way to programatically know is this is the case ? I would like to log that to our app's log thanks Ricardo From taj at www.linux.org.uk Wed Apr 6 15:10:20 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 6 Apr 2005 22:10:20 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4253F346.50102@emation.pt> References: <4253F346.50102@emation.pt> Message-ID: On Wed, 6 Apr 2005, Ricardo Trindade wrote: > Hi, > > I want to make sure my deployments have the same version of RXTX jar > and native lib. > > I know the version of the jar can be obtained in the Version class, > but how can I obtain the native version ? > > I know RXTX prints to the console a warning if the version is > different. Is there a way to programatically know is this is the case ? > > I would like to log that to our app's log > There isn't a suggested way of doing that right now. We could move things around and have a static String RXTXVersion.getNativeVersion() in future releases. Is this what you expected? This is not documented in commapi at all. I just tossed that in to catch conflicts while developing. It would be nice to have access in GUI applications though. It may be possible to access RXTXCommDriver.LibVersion right now. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Thu Apr 7 02:51:00 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 09:51:00 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> Message-ID: <4254F474.7020905@emation.pt> >There isn't a suggested way of doing that right now. We could move things >around and have a static String RXTXVersion.getNativeVersion() in future >releases. Is this what you expected? > > Yes, that would be perfect. >This is not documented in commapi at all. I just tossed that in to catch >conflicts while developing. It would be nice to have access in GUI >applications though. > >It may be possible to access RXTXCommDriver.LibVersion right now. > > > I tried, and I don't think it's possible. From taj at www.linux.org.uk Thu Apr 7 03:32:04 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 7 Apr 2005 10:32:04 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4254F474.7020905@emation.pt> References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: On Thu, 7 Apr 2005, Ricardo Trindade wrote: > > >There isn't a suggested way of doing that right now. We could move things > >around and have a static String RXTXVersion.getNativeVersion() in future > >releases. Is this what you expected? > > > > > > Yes, that would be perfect. > The attached should do what you want. You will still need to catch an exception for older versions... -- Trent Jarvi taj at www.linux.org.uk -------------- next part -------------- ? public_version.patch Index: RXTXCommDriver.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXCommDriver.java,v retrieving revision 1.16.2.51 diff -u -r1.16.2.51 RXTXCommDriver.java --- RXTXCommDriver.java 12 Oct 2004 09:13:30 -0000 1.16.2.51 +++ RXTXCommDriver.java 7 Apr 2005 09:29:04 -0000 @@ -54,7 +54,7 @@ the Library. */ String JarVersion = RXTXVersion.getVersion(); - String LibVersion = nativeGetVersion(); + String LibVersion = RXTXVersion.nativeGetVersion(); if ( devel ) { System.out.println("Devel Library"); @@ -76,7 +76,6 @@ /** Get the Serial port prefixes for the running OS */ private String deviceDirectory; private String osName; - private static native String nativeGetVersion(); private native boolean registerKnownPorts(int PortType); private native boolean isPortPrefixValid(String dev); private native boolean testRead(String dev, int type); Index: RXTXVersion.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXVersion.java,v retrieving revision 1.2.2.31 diff -u -r1.2.2.31 RXTXVersion.java --- RXTXVersion.java 16 Oct 2004 16:20:35 -0000 1.2.2.31 +++ RXTXVersion.java 7 Apr 2005 09:29:04 -0000 @@ -36,6 +36,7 @@ private static String Version; static { + System.loadLibrary( "rxtxSerial" ); Version = "RXTX-2.1-7pre20"; } /** @@ -47,4 +48,5 @@ { return(Version); } + public static native String nativeGetVersion(); } Index: SerialImp.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v retrieving revision 1.46.2.181 diff -u -r1.46.2.181 SerialImp.c --- SerialImp.c 17 Oct 2004 09:48:56 -0000 1.46.2.181 +++ SerialImp.c 7 Apr 2005 09:29:07 -0000 @@ -116,6 +116,7 @@ * It will eventually be removed. * */ #define RXTXPort(foo) Java_gnu_io_RXTXPort_ ## foo +#define RXTXVersion(foo) Java_gnu_io_RXTXVersion_ ## foo #define RXTXCommDriver(foo) Java_gnu_io_RXTXCommDriver_ ## foo #if defined(__sun__) || defined(__hpux__) @@ -4001,7 +4002,7 @@ } /*---------------------------------------------------------- -RXTXCommDriver.nativeGetVersion +RXTXVersion.nativeGetVersion accept: none perform: return the current version @@ -4010,9 +4011,10 @@ comments: This is used to avoid mixing versions of the .jar and native library. First introduced in rxtx-1.5-9 + Moved from RXTXCommDriver to RXTXVersion in rxtx-2.1-7 ----------------------------------------------------------*/ -JNIEXPORT jstring JNICALL RXTXCommDriver(nativeGetVersion) (JNIEnv *env, +JNIEXPORT jstring JNICALL RXTXVersion(nativeGetVersion) (JNIEnv *env, jclass jclazz ) { return (*env)->NewStringUTF( env, "RXTX-2.1-7pre20" ); From ricardo.trindade at emation.pt Thu Apr 7 03:45:58 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 10:45:58 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: <42550156.2040908@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050407/05212451/attachment-0157.html From thomas.shulok at lmco.com Thu Apr 7 17:43:11 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Thu, 07 Apr 2005 19:43:11 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi There, I'm attempting to talk RS232 between an embedded Linux box and a Windows box. Everything connects up fine, and I can send and receive a simple sequence of bytes with no problems. However, if around 5 seconds goes by without me sending something, I get the following when I attempt to send. java.io.IOException: Input/output error in writeArray Stack trace: java/lang/Throwable.()V java/lang/Throwable.(Ljava/lang/String;)V java/io/IOException.(Ljava/lang/String;)V gnu/io/RXTXPort.writeArray([BIIZ)V gnu/io/RXTXPort$SerialOutputStream.write([B)V SerialTest.main([Ljava/lang/String;)V If there interval is shorter (say 2 seconds between sends), I have no problems. On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and librxtxSerial-2.0.7pre2.so. Any ideas? Thanks, Thom -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5b23dcf/attachment-0157.html From taj at www.linux.org.uk Thu Apr 7 19:22:36 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:22:36 +0100 (BST) Subject: [Rxtx] Input/output error in writeArray In-Reply-To: References: Message-ID: On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a Windows > box. Everything connects up fine, and I can send and receive a simple > sequence of bytes with no problems. However, if around 5 seconds goes > by without me sending something, I get the following when I attempt to > send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Apr 7 19:24:59 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:24:59 +0100 (BST) Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) Message-ID: hmm. This would not work from applets would it? -- Trent Jarvi taj at www.linux.org.uk ---------- Forwarded message ---------- Date: Thu, 07 Apr 2005 16:05:53 -0400 From: Chris Gaffney To: taj at www.linux.org.uk Subject: RXTX Libraries on Classpath fix Hi, I submitted a patch for RXTX a few weeks ago to allow for loading the native libraries from the classpath. Since sending it to you I found it wasn't working on windows. I've fixed the problem and created a new patch that should replace the older one. The actual change is a one line from a String.equals() to a String.startsWith(). Thanks for a great piece of software, -Chris Gaffney Grand Valley State University -------------- next part -------------- A non-text attachment was scrubbed... Name: libraries_on_classpath_fixed.patch Type: text/x-patch Size: 5617 bytes Desc: Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5d423b8/libraries_on_classpath_fixed-0157.bin From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From thomas.shulok at lmco.com Fri Apr 8 10:38:55 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Fri, 08 Apr 2005 12:38:55 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi Trent, Thanks for the prompt response. Before diving deeper, I was wondering if there is a timeout parameter somewhere in the stack that I have not set properly. Given the nature of the failure (only fails if the line has been idle for a few seconds), it feels like some kind of timeout issue... Thanks again, Thom -----Original Message----- From: rxtx-bounces at mail.linuxgrrls.org [mailto:rxtx-bounces at mail.linuxgrrls.org] On Behalf Of Trent Jarvi Sent: Thursday, April 07, 2005 6:23 PM To: Java RXTX discussion Subject: Re: [Rxtx] Input/output error in writeArray On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a > Windows box. Everything connects up fine, and I can send and receive > a simple sequence of bytes with no problems. However, if around 5 > seconds goes by without me sending something, I get the following when > I attempt to send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at mail.linuxgrrls.org http://mail.linuxgrrls.org/mailman/listinfo/rxtx From ricardo.trindade at emation.pt Mon Apr 4 09:17:23 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Mon, 04 Apr 2005 16:17:23 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot Message-ID: <42515A83.4050907@emation.pt> Hi, I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most recent stable snapshot), and get the following exception : It looks like rxtx has been compiled with jdk 1.5. If this was indeed the case, I think there is a compilation flag that generates code that runs on older jdks. java.lang.UnsupportedClassVersionError: gnu/io/UnsupportedCommOperationException (Unsupported major.minor version 49.0) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at java.net.URLClassLoader.defineClass(URLClassLoader.java:251) at java.net.URLClassLoader.access$100(URLClassLoader.java:55) at java.net.URLClassLoader$1.run(URLClassLoader.java:194) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:187) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:141) I'm trying to run it with 1.4. thanks Ricardo From taj at www.linux.org.uk Tue Apr 5 00:48:12 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 07:48:12 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42515A83.4050907@emation.pt> References: <42515A83.4050907@emation.pt> Message-ID: On Mon, 4 Apr 2005, Ricardo Trindade wrote: > Hi, > > I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most > recent stable snapshot), and get the following exception : > > It looks like rxtx has been compiled with jdk 1.5. If this was > indeed the case, I think there is a compilation flag that generates code > that runs on older jdks. > > java.lang.UnsupportedClassVersionError: > gnu/io/UnsupportedCommOperationException (Unsupported major.minor > version 49.0) [snip] Thanks Ricardo I recompiled the jar with javac -source 1.3 -target 1.3. That should cover most of the JRE's in use today. I also compiled the rxtx 2.0 x86_64 native library which appeared to be missing. I tried looking for flags to pass gcc 4.0 to make the native libraries more backwards compatible but only found options for C++ which is not used in rxtx. I've got a list of other bugs that I'll be going through in the next few weeks but for now I just left them with the same CVS filename - no code changes. ftp://ftp.qbang.org/pub/rxtx/rxtx-2.0-CVS-20050120-bins.tar.gz ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-CVS-20050120-bins.tar.gz -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Tue Apr 5 02:24:33 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 05 Apr 2005 09:24:33 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: References: <42515A83.4050907@emation.pt> Message-ID: <42524B41.3040300@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050405/5919abbb/attachment-0158.html From taj at www.linux.org.uk Tue Apr 5 03:00:29 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 10:00:29 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42524B41.3040300@emation.pt> References: <42515A83.4050907@emation.pt> <42524B41.3040300@emation.pt> Message-ID: On Tue, 5 Apr 2005, Ricardo Trindade wrote: > Will you anounce to the list when a new release is available ? > There will be several incremental releases announced here. Once those are done, we will release 2.1.7 and 2.0.7. -- Trent Jarvi taj at www.linux.org.uk From no_spam at somewhere.com Tue Apr 5 11:55:37 2005 From: no_spam at somewhere.com (no_spam@somewhere.com) Date: Tue, 5 Apr 2005 13:55:37 -0400 Subject: [Rxtx] Closing a port from an event listener results in a deadlock Message-ID: <20050405175537.GA21747@rcog.homelinux.net> On the message I sent on March 14, does anyone had the chance to try the modification? Or was it already fixed? (I haven't searched the archive extensively) Or maybe my message got catched by some spam filters? (it made it to the list archive though) Anyway, I would appreciate some feedback (through the list) Thanks From taj at www.linux.org.uk Tue Apr 5 14:42:28 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 21:42:28 +0100 (BST) Subject: [Rxtx] Closing a port from an event listener results in a deadlock In-Reply-To: <20050405175537.GA21747@rcog.homelinux.net> References: <20050405175537.GA21747@rcog.homelinux.net> Message-ID: On Tue, 5 Apr 2005 no_spam at somewhere.com wrote: > On the message I sent on March 14, does anyone had the chance to try the > modification? > > Or was it already fixed? (I haven't searched the archive extensively) > > Or maybe my message got catched by some spam filters? (it made it to the list > archive though) > > Anyway, I would appreciate some feedback (through the list) > The patch is here http://marc.theaimsgroup.com/?l=rxtx&m=111084488820288&w=2 I have applied this patch to a local copy but will not be doing formal testing for a couple weeks. I do not try to close ports from inside the eventListenter usually so I encourage any feedback also. If there are no problems reported, I expect this will go into rxtx 2.1-7. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Wed Apr 6 08:33:42 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Wed, 06 Apr 2005 15:33:42 +0100 Subject: [Rxtx] getting RXTX version Message-ID: <4253F346.50102@emation.pt> Hi, I want to make sure my deployments have the same version of RXTX jar and native lib. I know the version of the jar can be obtained in the Version class, but how can I obtain the native version ? I know RXTX prints to the console a warning if the version is different. Is there a way to programatically know is this is the case ? I would like to log that to our app's log thanks Ricardo From taj at www.linux.org.uk Wed Apr 6 15:10:20 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 6 Apr 2005 22:10:20 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4253F346.50102@emation.pt> References: <4253F346.50102@emation.pt> Message-ID: On Wed, 6 Apr 2005, Ricardo Trindade wrote: > Hi, > > I want to make sure my deployments have the same version of RXTX jar > and native lib. > > I know the version of the jar can be obtained in the Version class, > but how can I obtain the native version ? > > I know RXTX prints to the console a warning if the version is > different. Is there a way to programatically know is this is the case ? > > I would like to log that to our app's log > There isn't a suggested way of doing that right now. We could move things around and have a static String RXTXVersion.getNativeVersion() in future releases. Is this what you expected? This is not documented in commapi at all. I just tossed that in to catch conflicts while developing. It would be nice to have access in GUI applications though. It may be possible to access RXTXCommDriver.LibVersion right now. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Thu Apr 7 02:51:00 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 09:51:00 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> Message-ID: <4254F474.7020905@emation.pt> >There isn't a suggested way of doing that right now. We could move things >around and have a static String RXTXVersion.getNativeVersion() in future >releases. Is this what you expected? > > Yes, that would be perfect. >This is not documented in commapi at all. I just tossed that in to catch >conflicts while developing. It would be nice to have access in GUI >applications though. > >It may be possible to access RXTXCommDriver.LibVersion right now. > > > I tried, and I don't think it's possible. From taj at www.linux.org.uk Thu Apr 7 03:32:04 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 7 Apr 2005 10:32:04 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4254F474.7020905@emation.pt> References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: On Thu, 7 Apr 2005, Ricardo Trindade wrote: > > >There isn't a suggested way of doing that right now. We could move things > >around and have a static String RXTXVersion.getNativeVersion() in future > >releases. Is this what you expected? > > > > > > Yes, that would be perfect. > The attached should do what you want. You will still need to catch an exception for older versions... -- Trent Jarvi taj at www.linux.org.uk -------------- next part -------------- ? public_version.patch Index: RXTXCommDriver.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXCommDriver.java,v retrieving revision 1.16.2.51 diff -u -r1.16.2.51 RXTXCommDriver.java --- RXTXCommDriver.java 12 Oct 2004 09:13:30 -0000 1.16.2.51 +++ RXTXCommDriver.java 7 Apr 2005 09:29:04 -0000 @@ -54,7 +54,7 @@ the Library. */ String JarVersion = RXTXVersion.getVersion(); - String LibVersion = nativeGetVersion(); + String LibVersion = RXTXVersion.nativeGetVersion(); if ( devel ) { System.out.println("Devel Library"); @@ -76,7 +76,6 @@ /** Get the Serial port prefixes for the running OS */ private String deviceDirectory; private String osName; - private static native String nativeGetVersion(); private native boolean registerKnownPorts(int PortType); private native boolean isPortPrefixValid(String dev); private native boolean testRead(String dev, int type); Index: RXTXVersion.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXVersion.java,v retrieving revision 1.2.2.31 diff -u -r1.2.2.31 RXTXVersion.java --- RXTXVersion.java 16 Oct 2004 16:20:35 -0000 1.2.2.31 +++ RXTXVersion.java 7 Apr 2005 09:29:04 -0000 @@ -36,6 +36,7 @@ private static String Version; static { + System.loadLibrary( "rxtxSerial" ); Version = "RXTX-2.1-7pre20"; } /** @@ -47,4 +48,5 @@ { return(Version); } + public static native String nativeGetVersion(); } Index: SerialImp.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v retrieving revision 1.46.2.181 diff -u -r1.46.2.181 SerialImp.c --- SerialImp.c 17 Oct 2004 09:48:56 -0000 1.46.2.181 +++ SerialImp.c 7 Apr 2005 09:29:07 -0000 @@ -116,6 +116,7 @@ * It will eventually be removed. * */ #define RXTXPort(foo) Java_gnu_io_RXTXPort_ ## foo +#define RXTXVersion(foo) Java_gnu_io_RXTXVersion_ ## foo #define RXTXCommDriver(foo) Java_gnu_io_RXTXCommDriver_ ## foo #if defined(__sun__) || defined(__hpux__) @@ -4001,7 +4002,7 @@ } /*---------------------------------------------------------- -RXTXCommDriver.nativeGetVersion +RXTXVersion.nativeGetVersion accept: none perform: return the current version @@ -4010,9 +4011,10 @@ comments: This is used to avoid mixing versions of the .jar and native library. First introduced in rxtx-1.5-9 + Moved from RXTXCommDriver to RXTXVersion in rxtx-2.1-7 ----------------------------------------------------------*/ -JNIEXPORT jstring JNICALL RXTXCommDriver(nativeGetVersion) (JNIEnv *env, +JNIEXPORT jstring JNICALL RXTXVersion(nativeGetVersion) (JNIEnv *env, jclass jclazz ) { return (*env)->NewStringUTF( env, "RXTX-2.1-7pre20" ); From ricardo.trindade at emation.pt Thu Apr 7 03:45:58 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 10:45:58 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: <42550156.2040908@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050407/05212451/attachment-0158.html From thomas.shulok at lmco.com Thu Apr 7 17:43:11 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Thu, 07 Apr 2005 19:43:11 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi There, I'm attempting to talk RS232 between an embedded Linux box and a Windows box. Everything connects up fine, and I can send and receive a simple sequence of bytes with no problems. However, if around 5 seconds goes by without me sending something, I get the following when I attempt to send. java.io.IOException: Input/output error in writeArray Stack trace: java/lang/Throwable.()V java/lang/Throwable.(Ljava/lang/String;)V java/io/IOException.(Ljava/lang/String;)V gnu/io/RXTXPort.writeArray([BIIZ)V gnu/io/RXTXPort$SerialOutputStream.write([B)V SerialTest.main([Ljava/lang/String;)V If there interval is shorter (say 2 seconds between sends), I have no problems. On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and librxtxSerial-2.0.7pre2.so. Any ideas? Thanks, Thom -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5b23dcf/attachment-0158.html From taj at www.linux.org.uk Thu Apr 7 19:22:36 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:22:36 +0100 (BST) Subject: [Rxtx] Input/output error in writeArray In-Reply-To: References: Message-ID: On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a Windows > box. Everything connects up fine, and I can send and receive a simple > sequence of bytes with no problems. However, if around 5 seconds goes > by without me sending something, I get the following when I attempt to > send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Apr 7 19:24:59 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:24:59 +0100 (BST) Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) Message-ID: hmm. This would not work from applets would it? -- Trent Jarvi taj at www.linux.org.uk ---------- Forwarded message ---------- Date: Thu, 07 Apr 2005 16:05:53 -0400 From: Chris Gaffney To: taj at www.linux.org.uk Subject: RXTX Libraries on Classpath fix Hi, I submitted a patch for RXTX a few weeks ago to allow for loading the native libraries from the classpath. Since sending it to you I found it wasn't working on windows. I've fixed the problem and created a new patch that should replace the older one. The actual change is a one line from a String.equals() to a String.startsWith(). Thanks for a great piece of software, -Chris Gaffney Grand Valley State University -------------- next part -------------- A non-text attachment was scrubbed... Name: libraries_on_classpath_fixed.patch Type: text/x-patch Size: 5617 bytes Desc: Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5d423b8/libraries_on_classpath_fixed-0158.bin From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From thomas.shulok at lmco.com Fri Apr 8 10:38:55 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Fri, 08 Apr 2005 12:38:55 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi Trent, Thanks for the prompt response. Before diving deeper, I was wondering if there is a timeout parameter somewhere in the stack that I have not set properly. Given the nature of the failure (only fails if the line has been idle for a few seconds), it feels like some kind of timeout issue... Thanks again, Thom -----Original Message----- From: rxtx-bounces at mail.linuxgrrls.org [mailto:rxtx-bounces at mail.linuxgrrls.org] On Behalf Of Trent Jarvi Sent: Thursday, April 07, 2005 6:23 PM To: Java RXTX discussion Subject: Re: [Rxtx] Input/output error in writeArray On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a > Windows box. Everything connects up fine, and I can send and receive > a simple sequence of bytes with no problems. However, if around 5 > seconds goes by without me sending something, I get the following when > I attempt to send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at mail.linuxgrrls.org http://mail.linuxgrrls.org/mailman/listinfo/rxtx From ricardo.trindade at emation.pt Mon Apr 4 09:17:23 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Mon, 04 Apr 2005 16:17:23 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot Message-ID: <42515A83.4050907@emation.pt> Hi, I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most recent stable snapshot), and get the following exception : It looks like rxtx has been compiled with jdk 1.5. If this was indeed the case, I think there is a compilation flag that generates code that runs on older jdks. java.lang.UnsupportedClassVersionError: gnu/io/UnsupportedCommOperationException (Unsupported major.minor version 49.0) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at java.net.URLClassLoader.defineClass(URLClassLoader.java:251) at java.net.URLClassLoader.access$100(URLClassLoader.java:55) at java.net.URLClassLoader$1.run(URLClassLoader.java:194) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:187) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:141) I'm trying to run it with 1.4. thanks Ricardo From taj at www.linux.org.uk Tue Apr 5 00:48:12 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 07:48:12 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42515A83.4050907@emation.pt> References: <42515A83.4050907@emation.pt> Message-ID: On Mon, 4 Apr 2005, Ricardo Trindade wrote: > Hi, > > I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most > recent stable snapshot), and get the following exception : > > It looks like rxtx has been compiled with jdk 1.5. If this was > indeed the case, I think there is a compilation flag that generates code > that runs on older jdks. > > java.lang.UnsupportedClassVersionError: > gnu/io/UnsupportedCommOperationException (Unsupported major.minor > version 49.0) [snip] Thanks Ricardo I recompiled the jar with javac -source 1.3 -target 1.3. That should cover most of the JRE's in use today. I also compiled the rxtx 2.0 x86_64 native library which appeared to be missing. I tried looking for flags to pass gcc 4.0 to make the native libraries more backwards compatible but only found options for C++ which is not used in rxtx. I've got a list of other bugs that I'll be going through in the next few weeks but for now I just left them with the same CVS filename - no code changes. ftp://ftp.qbang.org/pub/rxtx/rxtx-2.0-CVS-20050120-bins.tar.gz ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-CVS-20050120-bins.tar.gz -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Tue Apr 5 02:24:33 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 05 Apr 2005 09:24:33 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: References: <42515A83.4050907@emation.pt> Message-ID: <42524B41.3040300@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050405/5919abbb/attachment-0159.html From taj at www.linux.org.uk Tue Apr 5 03:00:29 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 10:00:29 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42524B41.3040300@emation.pt> References: <42515A83.4050907@emation.pt> <42524B41.3040300@emation.pt> Message-ID: On Tue, 5 Apr 2005, Ricardo Trindade wrote: > Will you anounce to the list when a new release is available ? > There will be several incremental releases announced here. Once those are done, we will release 2.1.7 and 2.0.7. -- Trent Jarvi taj at www.linux.org.uk From no_spam at somewhere.com Tue Apr 5 11:55:37 2005 From: no_spam at somewhere.com (no_spam@somewhere.com) Date: Tue, 5 Apr 2005 13:55:37 -0400 Subject: [Rxtx] Closing a port from an event listener results in a deadlock Message-ID: <20050405175537.GA21747@rcog.homelinux.net> On the message I sent on March 14, does anyone had the chance to try the modification? Or was it already fixed? (I haven't searched the archive extensively) Or maybe my message got catched by some spam filters? (it made it to the list archive though) Anyway, I would appreciate some feedback (through the list) Thanks From taj at www.linux.org.uk Tue Apr 5 14:42:28 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 21:42:28 +0100 (BST) Subject: [Rxtx] Closing a port from an event listener results in a deadlock In-Reply-To: <20050405175537.GA21747@rcog.homelinux.net> References: <20050405175537.GA21747@rcog.homelinux.net> Message-ID: On Tue, 5 Apr 2005 no_spam at somewhere.com wrote: > On the message I sent on March 14, does anyone had the chance to try the > modification? > > Or was it already fixed? (I haven't searched the archive extensively) > > Or maybe my message got catched by some spam filters? (it made it to the list > archive though) > > Anyway, I would appreciate some feedback (through the list) > The patch is here http://marc.theaimsgroup.com/?l=rxtx&m=111084488820288&w=2 I have applied this patch to a local copy but will not be doing formal testing for a couple weeks. I do not try to close ports from inside the eventListenter usually so I encourage any feedback also. If there are no problems reported, I expect this will go into rxtx 2.1-7. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Wed Apr 6 08:33:42 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Wed, 06 Apr 2005 15:33:42 +0100 Subject: [Rxtx] getting RXTX version Message-ID: <4253F346.50102@emation.pt> Hi, I want to make sure my deployments have the same version of RXTX jar and native lib. I know the version of the jar can be obtained in the Version class, but how can I obtain the native version ? I know RXTX prints to the console a warning if the version is different. Is there a way to programatically know is this is the case ? I would like to log that to our app's log thanks Ricardo From taj at www.linux.org.uk Wed Apr 6 15:10:20 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 6 Apr 2005 22:10:20 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4253F346.50102@emation.pt> References: <4253F346.50102@emation.pt> Message-ID: On Wed, 6 Apr 2005, Ricardo Trindade wrote: > Hi, > > I want to make sure my deployments have the same version of RXTX jar > and native lib. > > I know the version of the jar can be obtained in the Version class, > but how can I obtain the native version ? > > I know RXTX prints to the console a warning if the version is > different. Is there a way to programatically know is this is the case ? > > I would like to log that to our app's log > There isn't a suggested way of doing that right now. We could move things around and have a static String RXTXVersion.getNativeVersion() in future releases. Is this what you expected? This is not documented in commapi at all. I just tossed that in to catch conflicts while developing. It would be nice to have access in GUI applications though. It may be possible to access RXTXCommDriver.LibVersion right now. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Thu Apr 7 02:51:00 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 09:51:00 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> Message-ID: <4254F474.7020905@emation.pt> >There isn't a suggested way of doing that right now. We could move things >around and have a static String RXTXVersion.getNativeVersion() in future >releases. Is this what you expected? > > Yes, that would be perfect. >This is not documented in commapi at all. I just tossed that in to catch >conflicts while developing. It would be nice to have access in GUI >applications though. > >It may be possible to access RXTXCommDriver.LibVersion right now. > > > I tried, and I don't think it's possible. From taj at www.linux.org.uk Thu Apr 7 03:32:04 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 7 Apr 2005 10:32:04 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4254F474.7020905@emation.pt> References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: On Thu, 7 Apr 2005, Ricardo Trindade wrote: > > >There isn't a suggested way of doing that right now. We could move things > >around and have a static String RXTXVersion.getNativeVersion() in future > >releases. Is this what you expected? > > > > > > Yes, that would be perfect. > The attached should do what you want. You will still need to catch an exception for older versions... -- Trent Jarvi taj at www.linux.org.uk -------------- next part -------------- ? public_version.patch Index: RXTXCommDriver.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXCommDriver.java,v retrieving revision 1.16.2.51 diff -u -r1.16.2.51 RXTXCommDriver.java --- RXTXCommDriver.java 12 Oct 2004 09:13:30 -0000 1.16.2.51 +++ RXTXCommDriver.java 7 Apr 2005 09:29:04 -0000 @@ -54,7 +54,7 @@ the Library. */ String JarVersion = RXTXVersion.getVersion(); - String LibVersion = nativeGetVersion(); + String LibVersion = RXTXVersion.nativeGetVersion(); if ( devel ) { System.out.println("Devel Library"); @@ -76,7 +76,6 @@ /** Get the Serial port prefixes for the running OS */ private String deviceDirectory; private String osName; - private static native String nativeGetVersion(); private native boolean registerKnownPorts(int PortType); private native boolean isPortPrefixValid(String dev); private native boolean testRead(String dev, int type); Index: RXTXVersion.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXVersion.java,v retrieving revision 1.2.2.31 diff -u -r1.2.2.31 RXTXVersion.java --- RXTXVersion.java 16 Oct 2004 16:20:35 -0000 1.2.2.31 +++ RXTXVersion.java 7 Apr 2005 09:29:04 -0000 @@ -36,6 +36,7 @@ private static String Version; static { + System.loadLibrary( "rxtxSerial" ); Version = "RXTX-2.1-7pre20"; } /** @@ -47,4 +48,5 @@ { return(Version); } + public static native String nativeGetVersion(); } Index: SerialImp.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v retrieving revision 1.46.2.181 diff -u -r1.46.2.181 SerialImp.c --- SerialImp.c 17 Oct 2004 09:48:56 -0000 1.46.2.181 +++ SerialImp.c 7 Apr 2005 09:29:07 -0000 @@ -116,6 +116,7 @@ * It will eventually be removed. * */ #define RXTXPort(foo) Java_gnu_io_RXTXPort_ ## foo +#define RXTXVersion(foo) Java_gnu_io_RXTXVersion_ ## foo #define RXTXCommDriver(foo) Java_gnu_io_RXTXCommDriver_ ## foo #if defined(__sun__) || defined(__hpux__) @@ -4001,7 +4002,7 @@ } /*---------------------------------------------------------- -RXTXCommDriver.nativeGetVersion +RXTXVersion.nativeGetVersion accept: none perform: return the current version @@ -4010,9 +4011,10 @@ comments: This is used to avoid mixing versions of the .jar and native library. First introduced in rxtx-1.5-9 + Moved from RXTXCommDriver to RXTXVersion in rxtx-2.1-7 ----------------------------------------------------------*/ -JNIEXPORT jstring JNICALL RXTXCommDriver(nativeGetVersion) (JNIEnv *env, +JNIEXPORT jstring JNICALL RXTXVersion(nativeGetVersion) (JNIEnv *env, jclass jclazz ) { return (*env)->NewStringUTF( env, "RXTX-2.1-7pre20" ); From ricardo.trindade at emation.pt Thu Apr 7 03:45:58 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 10:45:58 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: <42550156.2040908@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050407/05212451/attachment-0159.html From thomas.shulok at lmco.com Thu Apr 7 17:43:11 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Thu, 07 Apr 2005 19:43:11 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi There, I'm attempting to talk RS232 between an embedded Linux box and a Windows box. Everything connects up fine, and I can send and receive a simple sequence of bytes with no problems. However, if around 5 seconds goes by without me sending something, I get the following when I attempt to send. java.io.IOException: Input/output error in writeArray Stack trace: java/lang/Throwable.()V java/lang/Throwable.(Ljava/lang/String;)V java/io/IOException.(Ljava/lang/String;)V gnu/io/RXTXPort.writeArray([BIIZ)V gnu/io/RXTXPort$SerialOutputStream.write([B)V SerialTest.main([Ljava/lang/String;)V If there interval is shorter (say 2 seconds between sends), I have no problems. On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and librxtxSerial-2.0.7pre2.so. Any ideas? Thanks, Thom -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5b23dcf/attachment-0159.html From taj at www.linux.org.uk Thu Apr 7 19:22:36 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:22:36 +0100 (BST) Subject: [Rxtx] Input/output error in writeArray In-Reply-To: References: Message-ID: On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a Windows > box. Everything connects up fine, and I can send and receive a simple > sequence of bytes with no problems. However, if around 5 seconds goes > by without me sending something, I get the following when I attempt to > send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Apr 7 19:24:59 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:24:59 +0100 (BST) Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) Message-ID: hmm. This would not work from applets would it? -- Trent Jarvi taj at www.linux.org.uk ---------- Forwarded message ---------- Date: Thu, 07 Apr 2005 16:05:53 -0400 From: Chris Gaffney To: taj at www.linux.org.uk Subject: RXTX Libraries on Classpath fix Hi, I submitted a patch for RXTX a few weeks ago to allow for loading the native libraries from the classpath. Since sending it to you I found it wasn't working on windows. I've fixed the problem and created a new patch that should replace the older one. The actual change is a one line from a String.equals() to a String.startsWith(). Thanks for a great piece of software, -Chris Gaffney Grand Valley State University -------------- next part -------------- A non-text attachment was scrubbed... Name: libraries_on_classpath_fixed.patch Type: text/x-patch Size: 5617 bytes Desc: Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5d423b8/libraries_on_classpath_fixed-0159.bin From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From thomas.shulok at lmco.com Fri Apr 8 10:38:55 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Fri, 08 Apr 2005 12:38:55 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi Trent, Thanks for the prompt response. Before diving deeper, I was wondering if there is a timeout parameter somewhere in the stack that I have not set properly. Given the nature of the failure (only fails if the line has been idle for a few seconds), it feels like some kind of timeout issue... Thanks again, Thom -----Original Message----- From: rxtx-bounces at mail.linuxgrrls.org [mailto:rxtx-bounces at mail.linuxgrrls.org] On Behalf Of Trent Jarvi Sent: Thursday, April 07, 2005 6:23 PM To: Java RXTX discussion Subject: Re: [Rxtx] Input/output error in writeArray On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a > Windows box. Everything connects up fine, and I can send and receive > a simple sequence of bytes with no problems. However, if around 5 > seconds goes by without me sending something, I get the following when > I attempt to send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at mail.linuxgrrls.org http://mail.linuxgrrls.org/mailman/listinfo/rxtx From ricardo.trindade at emation.pt Mon Apr 4 09:17:23 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Mon, 04 Apr 2005 16:17:23 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot Message-ID: <42515A83.4050907@emation.pt> Hi, I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most recent stable snapshot), and get the following exception : It looks like rxtx has been compiled with jdk 1.5. If this was indeed the case, I think there is a compilation flag that generates code that runs on older jdks. java.lang.UnsupportedClassVersionError: gnu/io/UnsupportedCommOperationException (Unsupported major.minor version 49.0) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at java.net.URLClassLoader.defineClass(URLClassLoader.java:251) at java.net.URLClassLoader.access$100(URLClassLoader.java:55) at java.net.URLClassLoader$1.run(URLClassLoader.java:194) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:187) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:141) I'm trying to run it with 1.4. thanks Ricardo From taj at www.linux.org.uk Tue Apr 5 00:48:12 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 07:48:12 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42515A83.4050907@emation.pt> References: <42515A83.4050907@emation.pt> Message-ID: On Mon, 4 Apr 2005, Ricardo Trindade wrote: > Hi, > > I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most > recent stable snapshot), and get the following exception : > > It looks like rxtx has been compiled with jdk 1.5. If this was > indeed the case, I think there is a compilation flag that generates code > that runs on older jdks. > > java.lang.UnsupportedClassVersionError: > gnu/io/UnsupportedCommOperationException (Unsupported major.minor > version 49.0) [snip] Thanks Ricardo I recompiled the jar with javac -source 1.3 -target 1.3. That should cover most of the JRE's in use today. I also compiled the rxtx 2.0 x86_64 native library which appeared to be missing. I tried looking for flags to pass gcc 4.0 to make the native libraries more backwards compatible but only found options for C++ which is not used in rxtx. I've got a list of other bugs that I'll be going through in the next few weeks but for now I just left them with the same CVS filename - no code changes. ftp://ftp.qbang.org/pub/rxtx/rxtx-2.0-CVS-20050120-bins.tar.gz ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-CVS-20050120-bins.tar.gz -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Tue Apr 5 02:24:33 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 05 Apr 2005 09:24:33 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: References: <42515A83.4050907@emation.pt> Message-ID: <42524B41.3040300@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050405/5919abbb/attachment-0160.html From taj at www.linux.org.uk Tue Apr 5 03:00:29 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 10:00:29 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42524B41.3040300@emation.pt> References: <42515A83.4050907@emation.pt> <42524B41.3040300@emation.pt> Message-ID: On Tue, 5 Apr 2005, Ricardo Trindade wrote: > Will you anounce to the list when a new release is available ? > There will be several incremental releases announced here. Once those are done, we will release 2.1.7 and 2.0.7. -- Trent Jarvi taj at www.linux.org.uk From no_spam at somewhere.com Tue Apr 5 11:55:37 2005 From: no_spam at somewhere.com (no_spam@somewhere.com) Date: Tue, 5 Apr 2005 13:55:37 -0400 Subject: [Rxtx] Closing a port from an event listener results in a deadlock Message-ID: <20050405175537.GA21747@rcog.homelinux.net> On the message I sent on March 14, does anyone had the chance to try the modification? Or was it already fixed? (I haven't searched the archive extensively) Or maybe my message got catched by some spam filters? (it made it to the list archive though) Anyway, I would appreciate some feedback (through the list) Thanks From taj at www.linux.org.uk Tue Apr 5 14:42:28 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 21:42:28 +0100 (BST) Subject: [Rxtx] Closing a port from an event listener results in a deadlock In-Reply-To: <20050405175537.GA21747@rcog.homelinux.net> References: <20050405175537.GA21747@rcog.homelinux.net> Message-ID: On Tue, 5 Apr 2005 no_spam at somewhere.com wrote: > On the message I sent on March 14, does anyone had the chance to try the > modification? > > Or was it already fixed? (I haven't searched the archive extensively) > > Or maybe my message got catched by some spam filters? (it made it to the list > archive though) > > Anyway, I would appreciate some feedback (through the list) > The patch is here http://marc.theaimsgroup.com/?l=rxtx&m=111084488820288&w=2 I have applied this patch to a local copy but will not be doing formal testing for a couple weeks. I do not try to close ports from inside the eventListenter usually so I encourage any feedback also. If there are no problems reported, I expect this will go into rxtx 2.1-7. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Wed Apr 6 08:33:42 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Wed, 06 Apr 2005 15:33:42 +0100 Subject: [Rxtx] getting RXTX version Message-ID: <4253F346.50102@emation.pt> Hi, I want to make sure my deployments have the same version of RXTX jar and native lib. I know the version of the jar can be obtained in the Version class, but how can I obtain the native version ? I know RXTX prints to the console a warning if the version is different. Is there a way to programatically know is this is the case ? I would like to log that to our app's log thanks Ricardo From taj at www.linux.org.uk Wed Apr 6 15:10:20 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 6 Apr 2005 22:10:20 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4253F346.50102@emation.pt> References: <4253F346.50102@emation.pt> Message-ID: On Wed, 6 Apr 2005, Ricardo Trindade wrote: > Hi, > > I want to make sure my deployments have the same version of RXTX jar > and native lib. > > I know the version of the jar can be obtained in the Version class, > but how can I obtain the native version ? > > I know RXTX prints to the console a warning if the version is > different. Is there a way to programatically know is this is the case ? > > I would like to log that to our app's log > There isn't a suggested way of doing that right now. We could move things around and have a static String RXTXVersion.getNativeVersion() in future releases. Is this what you expected? This is not documented in commapi at all. I just tossed that in to catch conflicts while developing. It would be nice to have access in GUI applications though. It may be possible to access RXTXCommDriver.LibVersion right now. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Thu Apr 7 02:51:00 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 09:51:00 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> Message-ID: <4254F474.7020905@emation.pt> >There isn't a suggested way of doing that right now. We could move things >around and have a static String RXTXVersion.getNativeVersion() in future >releases. Is this what you expected? > > Yes, that would be perfect. >This is not documented in commapi at all. I just tossed that in to catch >conflicts while developing. It would be nice to have access in GUI >applications though. > >It may be possible to access RXTXCommDriver.LibVersion right now. > > > I tried, and I don't think it's possible. From taj at www.linux.org.uk Thu Apr 7 03:32:04 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 7 Apr 2005 10:32:04 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4254F474.7020905@emation.pt> References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: On Thu, 7 Apr 2005, Ricardo Trindade wrote: > > >There isn't a suggested way of doing that right now. We could move things > >around and have a static String RXTXVersion.getNativeVersion() in future > >releases. Is this what you expected? > > > > > > Yes, that would be perfect. > The attached should do what you want. You will still need to catch an exception for older versions... -- Trent Jarvi taj at www.linux.org.uk -------------- next part -------------- ? public_version.patch Index: RXTXCommDriver.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXCommDriver.java,v retrieving revision 1.16.2.51 diff -u -r1.16.2.51 RXTXCommDriver.java --- RXTXCommDriver.java 12 Oct 2004 09:13:30 -0000 1.16.2.51 +++ RXTXCommDriver.java 7 Apr 2005 09:29:04 -0000 @@ -54,7 +54,7 @@ the Library. */ String JarVersion = RXTXVersion.getVersion(); - String LibVersion = nativeGetVersion(); + String LibVersion = RXTXVersion.nativeGetVersion(); if ( devel ) { System.out.println("Devel Library"); @@ -76,7 +76,6 @@ /** Get the Serial port prefixes for the running OS */ private String deviceDirectory; private String osName; - private static native String nativeGetVersion(); private native boolean registerKnownPorts(int PortType); private native boolean isPortPrefixValid(String dev); private native boolean testRead(String dev, int type); Index: RXTXVersion.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXVersion.java,v retrieving revision 1.2.2.31 diff -u -r1.2.2.31 RXTXVersion.java --- RXTXVersion.java 16 Oct 2004 16:20:35 -0000 1.2.2.31 +++ RXTXVersion.java 7 Apr 2005 09:29:04 -0000 @@ -36,6 +36,7 @@ private static String Version; static { + System.loadLibrary( "rxtxSerial" ); Version = "RXTX-2.1-7pre20"; } /** @@ -47,4 +48,5 @@ { return(Version); } + public static native String nativeGetVersion(); } Index: SerialImp.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v retrieving revision 1.46.2.181 diff -u -r1.46.2.181 SerialImp.c --- SerialImp.c 17 Oct 2004 09:48:56 -0000 1.46.2.181 +++ SerialImp.c 7 Apr 2005 09:29:07 -0000 @@ -116,6 +116,7 @@ * It will eventually be removed. * */ #define RXTXPort(foo) Java_gnu_io_RXTXPort_ ## foo +#define RXTXVersion(foo) Java_gnu_io_RXTXVersion_ ## foo #define RXTXCommDriver(foo) Java_gnu_io_RXTXCommDriver_ ## foo #if defined(__sun__) || defined(__hpux__) @@ -4001,7 +4002,7 @@ } /*---------------------------------------------------------- -RXTXCommDriver.nativeGetVersion +RXTXVersion.nativeGetVersion accept: none perform: return the current version @@ -4010,9 +4011,10 @@ comments: This is used to avoid mixing versions of the .jar and native library. First introduced in rxtx-1.5-9 + Moved from RXTXCommDriver to RXTXVersion in rxtx-2.1-7 ----------------------------------------------------------*/ -JNIEXPORT jstring JNICALL RXTXCommDriver(nativeGetVersion) (JNIEnv *env, +JNIEXPORT jstring JNICALL RXTXVersion(nativeGetVersion) (JNIEnv *env, jclass jclazz ) { return (*env)->NewStringUTF( env, "RXTX-2.1-7pre20" ); From ricardo.trindade at emation.pt Thu Apr 7 03:45:58 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 10:45:58 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: <42550156.2040908@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050407/05212451/attachment-0160.html From thomas.shulok at lmco.com Thu Apr 7 17:43:11 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Thu, 07 Apr 2005 19:43:11 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi There, I'm attempting to talk RS232 between an embedded Linux box and a Windows box. Everything connects up fine, and I can send and receive a simple sequence of bytes with no problems. However, if around 5 seconds goes by without me sending something, I get the following when I attempt to send. java.io.IOException: Input/output error in writeArray Stack trace: java/lang/Throwable.()V java/lang/Throwable.(Ljava/lang/String;)V java/io/IOException.(Ljava/lang/String;)V gnu/io/RXTXPort.writeArray([BIIZ)V gnu/io/RXTXPort$SerialOutputStream.write([B)V SerialTest.main([Ljava/lang/String;)V If there interval is shorter (say 2 seconds between sends), I have no problems. On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and librxtxSerial-2.0.7pre2.so. Any ideas? Thanks, Thom -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5b23dcf/attachment-0160.html From taj at www.linux.org.uk Thu Apr 7 19:22:36 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:22:36 +0100 (BST) Subject: [Rxtx] Input/output error in writeArray In-Reply-To: References: Message-ID: On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a Windows > box. Everything connects up fine, and I can send and receive a simple > sequence of bytes with no problems. However, if around 5 seconds goes > by without me sending something, I get the following when I attempt to > send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Apr 7 19:24:59 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:24:59 +0100 (BST) Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) Message-ID: hmm. This would not work from applets would it? -- Trent Jarvi taj at www.linux.org.uk ---------- Forwarded message ---------- Date: Thu, 07 Apr 2005 16:05:53 -0400 From: Chris Gaffney To: taj at www.linux.org.uk Subject: RXTX Libraries on Classpath fix Hi, I submitted a patch for RXTX a few weeks ago to allow for loading the native libraries from the classpath. Since sending it to you I found it wasn't working on windows. I've fixed the problem and created a new patch that should replace the older one. The actual change is a one line from a String.equals() to a String.startsWith(). Thanks for a great piece of software, -Chris Gaffney Grand Valley State University -------------- next part -------------- A non-text attachment was scrubbed... Name: libraries_on_classpath_fixed.patch Type: text/x-patch Size: 5617 bytes Desc: Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5d423b8/libraries_on_classpath_fixed-0160.bin From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From thomas.shulok at lmco.com Fri Apr 8 10:38:55 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Fri, 08 Apr 2005 12:38:55 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi Trent, Thanks for the prompt response. Before diving deeper, I was wondering if there is a timeout parameter somewhere in the stack that I have not set properly. Given the nature of the failure (only fails if the line has been idle for a few seconds), it feels like some kind of timeout issue... Thanks again, Thom -----Original Message----- From: rxtx-bounces at mail.linuxgrrls.org [mailto:rxtx-bounces at mail.linuxgrrls.org] On Behalf Of Trent Jarvi Sent: Thursday, April 07, 2005 6:23 PM To: Java RXTX discussion Subject: Re: [Rxtx] Input/output error in writeArray On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a > Windows box. Everything connects up fine, and I can send and receive > a simple sequence of bytes with no problems. However, if around 5 > seconds goes by without me sending something, I get the following when > I attempt to send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at mail.linuxgrrls.org http://mail.linuxgrrls.org/mailman/listinfo/rxtx From ricardo.trindade at emation.pt Mon Apr 4 09:17:23 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Mon, 04 Apr 2005 16:17:23 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot Message-ID: <42515A83.4050907@emation.pt> Hi, I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most recent stable snapshot), and get the following exception : It looks like rxtx has been compiled with jdk 1.5. If this was indeed the case, I think there is a compilation flag that generates code that runs on older jdks. java.lang.UnsupportedClassVersionError: gnu/io/UnsupportedCommOperationException (Unsupported major.minor version 49.0) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at java.net.URLClassLoader.defineClass(URLClassLoader.java:251) at java.net.URLClassLoader.access$100(URLClassLoader.java:55) at java.net.URLClassLoader$1.run(URLClassLoader.java:194) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:187) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:141) I'm trying to run it with 1.4. thanks Ricardo From taj at www.linux.org.uk Tue Apr 5 00:48:12 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 07:48:12 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42515A83.4050907@emation.pt> References: <42515A83.4050907@emation.pt> Message-ID: On Mon, 4 Apr 2005, Ricardo Trindade wrote: > Hi, > > I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most > recent stable snapshot), and get the following exception : > > It looks like rxtx has been compiled with jdk 1.5. If this was > indeed the case, I think there is a compilation flag that generates code > that runs on older jdks. > > java.lang.UnsupportedClassVersionError: > gnu/io/UnsupportedCommOperationException (Unsupported major.minor > version 49.0) [snip] Thanks Ricardo I recompiled the jar with javac -source 1.3 -target 1.3. That should cover most of the JRE's in use today. I also compiled the rxtx 2.0 x86_64 native library which appeared to be missing. I tried looking for flags to pass gcc 4.0 to make the native libraries more backwards compatible but only found options for C++ which is not used in rxtx. I've got a list of other bugs that I'll be going through in the next few weeks but for now I just left them with the same CVS filename - no code changes. ftp://ftp.qbang.org/pub/rxtx/rxtx-2.0-CVS-20050120-bins.tar.gz ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-CVS-20050120-bins.tar.gz -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Tue Apr 5 02:24:33 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 05 Apr 2005 09:24:33 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: References: <42515A83.4050907@emation.pt> Message-ID: <42524B41.3040300@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050405/5919abbb/attachment-0161.html From taj at www.linux.org.uk Tue Apr 5 03:00:29 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 10:00:29 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42524B41.3040300@emation.pt> References: <42515A83.4050907@emation.pt> <42524B41.3040300@emation.pt> Message-ID: On Tue, 5 Apr 2005, Ricardo Trindade wrote: > Will you anounce to the list when a new release is available ? > There will be several incremental releases announced here. Once those are done, we will release 2.1.7 and 2.0.7. -- Trent Jarvi taj at www.linux.org.uk From no_spam at somewhere.com Tue Apr 5 11:55:37 2005 From: no_spam at somewhere.com (no_spam@somewhere.com) Date: Tue, 5 Apr 2005 13:55:37 -0400 Subject: [Rxtx] Closing a port from an event listener results in a deadlock Message-ID: <20050405175537.GA21747@rcog.homelinux.net> On the message I sent on March 14, does anyone had the chance to try the modification? Or was it already fixed? (I haven't searched the archive extensively) Or maybe my message got catched by some spam filters? (it made it to the list archive though) Anyway, I would appreciate some feedback (through the list) Thanks From taj at www.linux.org.uk Tue Apr 5 14:42:28 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 21:42:28 +0100 (BST) Subject: [Rxtx] Closing a port from an event listener results in a deadlock In-Reply-To: <20050405175537.GA21747@rcog.homelinux.net> References: <20050405175537.GA21747@rcog.homelinux.net> Message-ID: On Tue, 5 Apr 2005 no_spam at somewhere.com wrote: > On the message I sent on March 14, does anyone had the chance to try the > modification? > > Or was it already fixed? (I haven't searched the archive extensively) > > Or maybe my message got catched by some spam filters? (it made it to the list > archive though) > > Anyway, I would appreciate some feedback (through the list) > The patch is here http://marc.theaimsgroup.com/?l=rxtx&m=111084488820288&w=2 I have applied this patch to a local copy but will not be doing formal testing for a couple weeks. I do not try to close ports from inside the eventListenter usually so I encourage any feedback also. If there are no problems reported, I expect this will go into rxtx 2.1-7. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Wed Apr 6 08:33:42 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Wed, 06 Apr 2005 15:33:42 +0100 Subject: [Rxtx] getting RXTX version Message-ID: <4253F346.50102@emation.pt> Hi, I want to make sure my deployments have the same version of RXTX jar and native lib. I know the version of the jar can be obtained in the Version class, but how can I obtain the native version ? I know RXTX prints to the console a warning if the version is different. Is there a way to programatically know is this is the case ? I would like to log that to our app's log thanks Ricardo From taj at www.linux.org.uk Wed Apr 6 15:10:20 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 6 Apr 2005 22:10:20 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4253F346.50102@emation.pt> References: <4253F346.50102@emation.pt> Message-ID: On Wed, 6 Apr 2005, Ricardo Trindade wrote: > Hi, > > I want to make sure my deployments have the same version of RXTX jar > and native lib. > > I know the version of the jar can be obtained in the Version class, > but how can I obtain the native version ? > > I know RXTX prints to the console a warning if the version is > different. Is there a way to programatically know is this is the case ? > > I would like to log that to our app's log > There isn't a suggested way of doing that right now. We could move things around and have a static String RXTXVersion.getNativeVersion() in future releases. Is this what you expected? This is not documented in commapi at all. I just tossed that in to catch conflicts while developing. It would be nice to have access in GUI applications though. It may be possible to access RXTXCommDriver.LibVersion right now. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Thu Apr 7 02:51:00 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 09:51:00 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> Message-ID: <4254F474.7020905@emation.pt> >There isn't a suggested way of doing that right now. We could move things >around and have a static String RXTXVersion.getNativeVersion() in future >releases. Is this what you expected? > > Yes, that would be perfect. >This is not documented in commapi at all. I just tossed that in to catch >conflicts while developing. It would be nice to have access in GUI >applications though. > >It may be possible to access RXTXCommDriver.LibVersion right now. > > > I tried, and I don't think it's possible. From taj at www.linux.org.uk Thu Apr 7 03:32:04 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 7 Apr 2005 10:32:04 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4254F474.7020905@emation.pt> References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: On Thu, 7 Apr 2005, Ricardo Trindade wrote: > > >There isn't a suggested way of doing that right now. We could move things > >around and have a static String RXTXVersion.getNativeVersion() in future > >releases. Is this what you expected? > > > > > > Yes, that would be perfect. > The attached should do what you want. You will still need to catch an exception for older versions... -- Trent Jarvi taj at www.linux.org.uk -------------- next part -------------- ? public_version.patch Index: RXTXCommDriver.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXCommDriver.java,v retrieving revision 1.16.2.51 diff -u -r1.16.2.51 RXTXCommDriver.java --- RXTXCommDriver.java 12 Oct 2004 09:13:30 -0000 1.16.2.51 +++ RXTXCommDriver.java 7 Apr 2005 09:29:04 -0000 @@ -54,7 +54,7 @@ the Library. */ String JarVersion = RXTXVersion.getVersion(); - String LibVersion = nativeGetVersion(); + String LibVersion = RXTXVersion.nativeGetVersion(); if ( devel ) { System.out.println("Devel Library"); @@ -76,7 +76,6 @@ /** Get the Serial port prefixes for the running OS */ private String deviceDirectory; private String osName; - private static native String nativeGetVersion(); private native boolean registerKnownPorts(int PortType); private native boolean isPortPrefixValid(String dev); private native boolean testRead(String dev, int type); Index: RXTXVersion.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXVersion.java,v retrieving revision 1.2.2.31 diff -u -r1.2.2.31 RXTXVersion.java --- RXTXVersion.java 16 Oct 2004 16:20:35 -0000 1.2.2.31 +++ RXTXVersion.java 7 Apr 2005 09:29:04 -0000 @@ -36,6 +36,7 @@ private static String Version; static { + System.loadLibrary( "rxtxSerial" ); Version = "RXTX-2.1-7pre20"; } /** @@ -47,4 +48,5 @@ { return(Version); } + public static native String nativeGetVersion(); } Index: SerialImp.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v retrieving revision 1.46.2.181 diff -u -r1.46.2.181 SerialImp.c --- SerialImp.c 17 Oct 2004 09:48:56 -0000 1.46.2.181 +++ SerialImp.c 7 Apr 2005 09:29:07 -0000 @@ -116,6 +116,7 @@ * It will eventually be removed. * */ #define RXTXPort(foo) Java_gnu_io_RXTXPort_ ## foo +#define RXTXVersion(foo) Java_gnu_io_RXTXVersion_ ## foo #define RXTXCommDriver(foo) Java_gnu_io_RXTXCommDriver_ ## foo #if defined(__sun__) || defined(__hpux__) @@ -4001,7 +4002,7 @@ } /*---------------------------------------------------------- -RXTXCommDriver.nativeGetVersion +RXTXVersion.nativeGetVersion accept: none perform: return the current version @@ -4010,9 +4011,10 @@ comments: This is used to avoid mixing versions of the .jar and native library. First introduced in rxtx-1.5-9 + Moved from RXTXCommDriver to RXTXVersion in rxtx-2.1-7 ----------------------------------------------------------*/ -JNIEXPORT jstring JNICALL RXTXCommDriver(nativeGetVersion) (JNIEnv *env, +JNIEXPORT jstring JNICALL RXTXVersion(nativeGetVersion) (JNIEnv *env, jclass jclazz ) { return (*env)->NewStringUTF( env, "RXTX-2.1-7pre20" ); From ricardo.trindade at emation.pt Thu Apr 7 03:45:58 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 10:45:58 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: <42550156.2040908@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050407/05212451/attachment-0161.html From thomas.shulok at lmco.com Thu Apr 7 17:43:11 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Thu, 07 Apr 2005 19:43:11 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi There, I'm attempting to talk RS232 between an embedded Linux box and a Windows box. Everything connects up fine, and I can send and receive a simple sequence of bytes with no problems. However, if around 5 seconds goes by without me sending something, I get the following when I attempt to send. java.io.IOException: Input/output error in writeArray Stack trace: java/lang/Throwable.()V java/lang/Throwable.(Ljava/lang/String;)V java/io/IOException.(Ljava/lang/String;)V gnu/io/RXTXPort.writeArray([BIIZ)V gnu/io/RXTXPort$SerialOutputStream.write([B)V SerialTest.main([Ljava/lang/String;)V If there interval is shorter (say 2 seconds between sends), I have no problems. On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and librxtxSerial-2.0.7pre2.so. Any ideas? Thanks, Thom -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5b23dcf/attachment-0161.html From taj at www.linux.org.uk Thu Apr 7 19:22:36 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:22:36 +0100 (BST) Subject: [Rxtx] Input/output error in writeArray In-Reply-To: References: Message-ID: On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a Windows > box. Everything connects up fine, and I can send and receive a simple > sequence of bytes with no problems. However, if around 5 seconds goes > by without me sending something, I get the following when I attempt to > send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Apr 7 19:24:59 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:24:59 +0100 (BST) Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) Message-ID: hmm. This would not work from applets would it? -- Trent Jarvi taj at www.linux.org.uk ---------- Forwarded message ---------- Date: Thu, 07 Apr 2005 16:05:53 -0400 From: Chris Gaffney To: taj at www.linux.org.uk Subject: RXTX Libraries on Classpath fix Hi, I submitted a patch for RXTX a few weeks ago to allow for loading the native libraries from the classpath. Since sending it to you I found it wasn't working on windows. I've fixed the problem and created a new patch that should replace the older one. The actual change is a one line from a String.equals() to a String.startsWith(). Thanks for a great piece of software, -Chris Gaffney Grand Valley State University -------------- next part -------------- A non-text attachment was scrubbed... Name: libraries_on_classpath_fixed.patch Type: text/x-patch Size: 5617 bytes Desc: Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5d423b8/libraries_on_classpath_fixed-0161.bin From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From thomas.shulok at lmco.com Fri Apr 8 10:38:55 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Fri, 08 Apr 2005 12:38:55 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi Trent, Thanks for the prompt response. Before diving deeper, I was wondering if there is a timeout parameter somewhere in the stack that I have not set properly. Given the nature of the failure (only fails if the line has been idle for a few seconds), it feels like some kind of timeout issue... Thanks again, Thom -----Original Message----- From: rxtx-bounces at mail.linuxgrrls.org [mailto:rxtx-bounces at mail.linuxgrrls.org] On Behalf Of Trent Jarvi Sent: Thursday, April 07, 2005 6:23 PM To: Java RXTX discussion Subject: Re: [Rxtx] Input/output error in writeArray On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a > Windows box. Everything connects up fine, and I can send and receive > a simple sequence of bytes with no problems. However, if around 5 > seconds goes by without me sending something, I get the following when > I attempt to send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at mail.linuxgrrls.org http://mail.linuxgrrls.org/mailman/listinfo/rxtx From ricardo.trindade at emation.pt Mon Apr 4 09:17:23 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Mon, 04 Apr 2005 16:17:23 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot Message-ID: <42515A83.4050907@emation.pt> Hi, I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most recent stable snapshot), and get the following exception : It looks like rxtx has been compiled with jdk 1.5. If this was indeed the case, I think there is a compilation flag that generates code that runs on older jdks. java.lang.UnsupportedClassVersionError: gnu/io/UnsupportedCommOperationException (Unsupported major.minor version 49.0) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at java.net.URLClassLoader.defineClass(URLClassLoader.java:251) at java.net.URLClassLoader.access$100(URLClassLoader.java:55) at java.net.URLClassLoader$1.run(URLClassLoader.java:194) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:187) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:141) I'm trying to run it with 1.4. thanks Ricardo From taj at www.linux.org.uk Tue Apr 5 00:48:12 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 07:48:12 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42515A83.4050907@emation.pt> References: <42515A83.4050907@emation.pt> Message-ID: On Mon, 4 Apr 2005, Ricardo Trindade wrote: > Hi, > > I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most > recent stable snapshot), and get the following exception : > > It looks like rxtx has been compiled with jdk 1.5. If this was > indeed the case, I think there is a compilation flag that generates code > that runs on older jdks. > > java.lang.UnsupportedClassVersionError: > gnu/io/UnsupportedCommOperationException (Unsupported major.minor > version 49.0) [snip] Thanks Ricardo I recompiled the jar with javac -source 1.3 -target 1.3. That should cover most of the JRE's in use today. I also compiled the rxtx 2.0 x86_64 native library which appeared to be missing. I tried looking for flags to pass gcc 4.0 to make the native libraries more backwards compatible but only found options for C++ which is not used in rxtx. I've got a list of other bugs that I'll be going through in the next few weeks but for now I just left them with the same CVS filename - no code changes. ftp://ftp.qbang.org/pub/rxtx/rxtx-2.0-CVS-20050120-bins.tar.gz ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-CVS-20050120-bins.tar.gz -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Tue Apr 5 02:24:33 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 05 Apr 2005 09:24:33 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: References: <42515A83.4050907@emation.pt> Message-ID: <42524B41.3040300@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050405/5919abbb/attachment-0162.html From taj at www.linux.org.uk Tue Apr 5 03:00:29 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 10:00:29 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42524B41.3040300@emation.pt> References: <42515A83.4050907@emation.pt> <42524B41.3040300@emation.pt> Message-ID: On Tue, 5 Apr 2005, Ricardo Trindade wrote: > Will you anounce to the list when a new release is available ? > There will be several incremental releases announced here. Once those are done, we will release 2.1.7 and 2.0.7. -- Trent Jarvi taj at www.linux.org.uk From no_spam at somewhere.com Tue Apr 5 11:55:37 2005 From: no_spam at somewhere.com (no_spam@somewhere.com) Date: Tue, 5 Apr 2005 13:55:37 -0400 Subject: [Rxtx] Closing a port from an event listener results in a deadlock Message-ID: <20050405175537.GA21747@rcog.homelinux.net> On the message I sent on March 14, does anyone had the chance to try the modification? Or was it already fixed? (I haven't searched the archive extensively) Or maybe my message got catched by some spam filters? (it made it to the list archive though) Anyway, I would appreciate some feedback (through the list) Thanks From taj at www.linux.org.uk Tue Apr 5 14:42:28 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 21:42:28 +0100 (BST) Subject: [Rxtx] Closing a port from an event listener results in a deadlock In-Reply-To: <20050405175537.GA21747@rcog.homelinux.net> References: <20050405175537.GA21747@rcog.homelinux.net> Message-ID: On Tue, 5 Apr 2005 no_spam at somewhere.com wrote: > On the message I sent on March 14, does anyone had the chance to try the > modification? > > Or was it already fixed? (I haven't searched the archive extensively) > > Or maybe my message got catched by some spam filters? (it made it to the list > archive though) > > Anyway, I would appreciate some feedback (through the list) > The patch is here http://marc.theaimsgroup.com/?l=rxtx&m=111084488820288&w=2 I have applied this patch to a local copy but will not be doing formal testing for a couple weeks. I do not try to close ports from inside the eventListenter usually so I encourage any feedback also. If there are no problems reported, I expect this will go into rxtx 2.1-7. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Wed Apr 6 08:33:42 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Wed, 06 Apr 2005 15:33:42 +0100 Subject: [Rxtx] getting RXTX version Message-ID: <4253F346.50102@emation.pt> Hi, I want to make sure my deployments have the same version of RXTX jar and native lib. I know the version of the jar can be obtained in the Version class, but how can I obtain the native version ? I know RXTX prints to the console a warning if the version is different. Is there a way to programatically know is this is the case ? I would like to log that to our app's log thanks Ricardo From taj at www.linux.org.uk Wed Apr 6 15:10:20 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 6 Apr 2005 22:10:20 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4253F346.50102@emation.pt> References: <4253F346.50102@emation.pt> Message-ID: On Wed, 6 Apr 2005, Ricardo Trindade wrote: > Hi, > > I want to make sure my deployments have the same version of RXTX jar > and native lib. > > I know the version of the jar can be obtained in the Version class, > but how can I obtain the native version ? > > I know RXTX prints to the console a warning if the version is > different. Is there a way to programatically know is this is the case ? > > I would like to log that to our app's log > There isn't a suggested way of doing that right now. We could move things around and have a static String RXTXVersion.getNativeVersion() in future releases. Is this what you expected? This is not documented in commapi at all. I just tossed that in to catch conflicts while developing. It would be nice to have access in GUI applications though. It may be possible to access RXTXCommDriver.LibVersion right now. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Thu Apr 7 02:51:00 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 09:51:00 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> Message-ID: <4254F474.7020905@emation.pt> >There isn't a suggested way of doing that right now. We could move things >around and have a static String RXTXVersion.getNativeVersion() in future >releases. Is this what you expected? > > Yes, that would be perfect. >This is not documented in commapi at all. I just tossed that in to catch >conflicts while developing. It would be nice to have access in GUI >applications though. > >It may be possible to access RXTXCommDriver.LibVersion right now. > > > I tried, and I don't think it's possible. From taj at www.linux.org.uk Thu Apr 7 03:32:04 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 7 Apr 2005 10:32:04 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4254F474.7020905@emation.pt> References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: On Thu, 7 Apr 2005, Ricardo Trindade wrote: > > >There isn't a suggested way of doing that right now. We could move things > >around and have a static String RXTXVersion.getNativeVersion() in future > >releases. Is this what you expected? > > > > > > Yes, that would be perfect. > The attached should do what you want. You will still need to catch an exception for older versions... -- Trent Jarvi taj at www.linux.org.uk -------------- next part -------------- ? public_version.patch Index: RXTXCommDriver.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXCommDriver.java,v retrieving revision 1.16.2.51 diff -u -r1.16.2.51 RXTXCommDriver.java --- RXTXCommDriver.java 12 Oct 2004 09:13:30 -0000 1.16.2.51 +++ RXTXCommDriver.java 7 Apr 2005 09:29:04 -0000 @@ -54,7 +54,7 @@ the Library. */ String JarVersion = RXTXVersion.getVersion(); - String LibVersion = nativeGetVersion(); + String LibVersion = RXTXVersion.nativeGetVersion(); if ( devel ) { System.out.println("Devel Library"); @@ -76,7 +76,6 @@ /** Get the Serial port prefixes for the running OS */ private String deviceDirectory; private String osName; - private static native String nativeGetVersion(); private native boolean registerKnownPorts(int PortType); private native boolean isPortPrefixValid(String dev); private native boolean testRead(String dev, int type); Index: RXTXVersion.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXVersion.java,v retrieving revision 1.2.2.31 diff -u -r1.2.2.31 RXTXVersion.java --- RXTXVersion.java 16 Oct 2004 16:20:35 -0000 1.2.2.31 +++ RXTXVersion.java 7 Apr 2005 09:29:04 -0000 @@ -36,6 +36,7 @@ private static String Version; static { + System.loadLibrary( "rxtxSerial" ); Version = "RXTX-2.1-7pre20"; } /** @@ -47,4 +48,5 @@ { return(Version); } + public static native String nativeGetVersion(); } Index: SerialImp.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v retrieving revision 1.46.2.181 diff -u -r1.46.2.181 SerialImp.c --- SerialImp.c 17 Oct 2004 09:48:56 -0000 1.46.2.181 +++ SerialImp.c 7 Apr 2005 09:29:07 -0000 @@ -116,6 +116,7 @@ * It will eventually be removed. * */ #define RXTXPort(foo) Java_gnu_io_RXTXPort_ ## foo +#define RXTXVersion(foo) Java_gnu_io_RXTXVersion_ ## foo #define RXTXCommDriver(foo) Java_gnu_io_RXTXCommDriver_ ## foo #if defined(__sun__) || defined(__hpux__) @@ -4001,7 +4002,7 @@ } /*---------------------------------------------------------- -RXTXCommDriver.nativeGetVersion +RXTXVersion.nativeGetVersion accept: none perform: return the current version @@ -4010,9 +4011,10 @@ comments: This is used to avoid mixing versions of the .jar and native library. First introduced in rxtx-1.5-9 + Moved from RXTXCommDriver to RXTXVersion in rxtx-2.1-7 ----------------------------------------------------------*/ -JNIEXPORT jstring JNICALL RXTXCommDriver(nativeGetVersion) (JNIEnv *env, +JNIEXPORT jstring JNICALL RXTXVersion(nativeGetVersion) (JNIEnv *env, jclass jclazz ) { return (*env)->NewStringUTF( env, "RXTX-2.1-7pre20" ); From ricardo.trindade at emation.pt Thu Apr 7 03:45:58 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 10:45:58 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: <42550156.2040908@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050407/05212451/attachment-0162.html From thomas.shulok at lmco.com Thu Apr 7 17:43:11 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Thu, 07 Apr 2005 19:43:11 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi There, I'm attempting to talk RS232 between an embedded Linux box and a Windows box. Everything connects up fine, and I can send and receive a simple sequence of bytes with no problems. However, if around 5 seconds goes by without me sending something, I get the following when I attempt to send. java.io.IOException: Input/output error in writeArray Stack trace: java/lang/Throwable.()V java/lang/Throwable.(Ljava/lang/String;)V java/io/IOException.(Ljava/lang/String;)V gnu/io/RXTXPort.writeArray([BIIZ)V gnu/io/RXTXPort$SerialOutputStream.write([B)V SerialTest.main([Ljava/lang/String;)V If there interval is shorter (say 2 seconds between sends), I have no problems. On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and librxtxSerial-2.0.7pre2.so. Any ideas? Thanks, Thom -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5b23dcf/attachment-0162.html From taj at www.linux.org.uk Thu Apr 7 19:22:36 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:22:36 +0100 (BST) Subject: [Rxtx] Input/output error in writeArray In-Reply-To: References: Message-ID: On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a Windows > box. Everything connects up fine, and I can send and receive a simple > sequence of bytes with no problems. However, if around 5 seconds goes > by without me sending something, I get the following when I attempt to > send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Apr 7 19:24:59 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:24:59 +0100 (BST) Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) Message-ID: hmm. This would not work from applets would it? -- Trent Jarvi taj at www.linux.org.uk ---------- Forwarded message ---------- Date: Thu, 07 Apr 2005 16:05:53 -0400 From: Chris Gaffney To: taj at www.linux.org.uk Subject: RXTX Libraries on Classpath fix Hi, I submitted a patch for RXTX a few weeks ago to allow for loading the native libraries from the classpath. Since sending it to you I found it wasn't working on windows. I've fixed the problem and created a new patch that should replace the older one. The actual change is a one line from a String.equals() to a String.startsWith(). Thanks for a great piece of software, -Chris Gaffney Grand Valley State University -------------- next part -------------- A non-text attachment was scrubbed... Name: libraries_on_classpath_fixed.patch Type: text/x-patch Size: 5617 bytes Desc: Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5d423b8/libraries_on_classpath_fixed-0162.bin From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From thomas.shulok at lmco.com Fri Apr 8 10:38:55 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Fri, 08 Apr 2005 12:38:55 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi Trent, Thanks for the prompt response. Before diving deeper, I was wondering if there is a timeout parameter somewhere in the stack that I have not set properly. Given the nature of the failure (only fails if the line has been idle for a few seconds), it feels like some kind of timeout issue... Thanks again, Thom -----Original Message----- From: rxtx-bounces at mail.linuxgrrls.org [mailto:rxtx-bounces at mail.linuxgrrls.org] On Behalf Of Trent Jarvi Sent: Thursday, April 07, 2005 6:23 PM To: Java RXTX discussion Subject: Re: [Rxtx] Input/output error in writeArray On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a > Windows box. Everything connects up fine, and I can send and receive > a simple sequence of bytes with no problems. However, if around 5 > seconds goes by without me sending something, I get the following when > I attempt to send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at mail.linuxgrrls.org http://mail.linuxgrrls.org/mailman/listinfo/rxtx From ricardo.trindade at emation.pt Mon Apr 4 09:17:23 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Mon, 04 Apr 2005 16:17:23 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot Message-ID: <42515A83.4050907@emation.pt> Hi, I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most recent stable snapshot), and get the following exception : It looks like rxtx has been compiled with jdk 1.5. If this was indeed the case, I think there is a compilation flag that generates code that runs on older jdks. java.lang.UnsupportedClassVersionError: gnu/io/UnsupportedCommOperationException (Unsupported major.minor version 49.0) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at java.net.URLClassLoader.defineClass(URLClassLoader.java:251) at java.net.URLClassLoader.access$100(URLClassLoader.java:55) at java.net.URLClassLoader$1.run(URLClassLoader.java:194) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:187) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:141) I'm trying to run it with 1.4. thanks Ricardo From taj at www.linux.org.uk Tue Apr 5 00:48:12 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 07:48:12 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42515A83.4050907@emation.pt> References: <42515A83.4050907@emation.pt> Message-ID: On Mon, 4 Apr 2005, Ricardo Trindade wrote: > Hi, > > I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most > recent stable snapshot), and get the following exception : > > It looks like rxtx has been compiled with jdk 1.5. If this was > indeed the case, I think there is a compilation flag that generates code > that runs on older jdks. > > java.lang.UnsupportedClassVersionError: > gnu/io/UnsupportedCommOperationException (Unsupported major.minor > version 49.0) [snip] Thanks Ricardo I recompiled the jar with javac -source 1.3 -target 1.3. That should cover most of the JRE's in use today. I also compiled the rxtx 2.0 x86_64 native library which appeared to be missing. I tried looking for flags to pass gcc 4.0 to make the native libraries more backwards compatible but only found options for C++ which is not used in rxtx. I've got a list of other bugs that I'll be going through in the next few weeks but for now I just left them with the same CVS filename - no code changes. ftp://ftp.qbang.org/pub/rxtx/rxtx-2.0-CVS-20050120-bins.tar.gz ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-CVS-20050120-bins.tar.gz -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Tue Apr 5 02:24:33 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 05 Apr 2005 09:24:33 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: References: <42515A83.4050907@emation.pt> Message-ID: <42524B41.3040300@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050405/5919abbb/attachment-0163.html From taj at www.linux.org.uk Tue Apr 5 03:00:29 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 10:00:29 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42524B41.3040300@emation.pt> References: <42515A83.4050907@emation.pt> <42524B41.3040300@emation.pt> Message-ID: On Tue, 5 Apr 2005, Ricardo Trindade wrote: > Will you anounce to the list when a new release is available ? > There will be several incremental releases announced here. Once those are done, we will release 2.1.7 and 2.0.7. -- Trent Jarvi taj at www.linux.org.uk From no_spam at somewhere.com Tue Apr 5 11:55:37 2005 From: no_spam at somewhere.com (no_spam@somewhere.com) Date: Tue, 5 Apr 2005 13:55:37 -0400 Subject: [Rxtx] Closing a port from an event listener results in a deadlock Message-ID: <20050405175537.GA21747@rcog.homelinux.net> On the message I sent on March 14, does anyone had the chance to try the modification? Or was it already fixed? (I haven't searched the archive extensively) Or maybe my message got catched by some spam filters? (it made it to the list archive though) Anyway, I would appreciate some feedback (through the list) Thanks From taj at www.linux.org.uk Tue Apr 5 14:42:28 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 21:42:28 +0100 (BST) Subject: [Rxtx] Closing a port from an event listener results in a deadlock In-Reply-To: <20050405175537.GA21747@rcog.homelinux.net> References: <20050405175537.GA21747@rcog.homelinux.net> Message-ID: On Tue, 5 Apr 2005 no_spam at somewhere.com wrote: > On the message I sent on March 14, does anyone had the chance to try the > modification? > > Or was it already fixed? (I haven't searched the archive extensively) > > Or maybe my message got catched by some spam filters? (it made it to the list > archive though) > > Anyway, I would appreciate some feedback (through the list) > The patch is here http://marc.theaimsgroup.com/?l=rxtx&m=111084488820288&w=2 I have applied this patch to a local copy but will not be doing formal testing for a couple weeks. I do not try to close ports from inside the eventListenter usually so I encourage any feedback also. If there are no problems reported, I expect this will go into rxtx 2.1-7. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Wed Apr 6 08:33:42 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Wed, 06 Apr 2005 15:33:42 +0100 Subject: [Rxtx] getting RXTX version Message-ID: <4253F346.50102@emation.pt> Hi, I want to make sure my deployments have the same version of RXTX jar and native lib. I know the version of the jar can be obtained in the Version class, but how can I obtain the native version ? I know RXTX prints to the console a warning if the version is different. Is there a way to programatically know is this is the case ? I would like to log that to our app's log thanks Ricardo From taj at www.linux.org.uk Wed Apr 6 15:10:20 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 6 Apr 2005 22:10:20 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4253F346.50102@emation.pt> References: <4253F346.50102@emation.pt> Message-ID: On Wed, 6 Apr 2005, Ricardo Trindade wrote: > Hi, > > I want to make sure my deployments have the same version of RXTX jar > and native lib. > > I know the version of the jar can be obtained in the Version class, > but how can I obtain the native version ? > > I know RXTX prints to the console a warning if the version is > different. Is there a way to programatically know is this is the case ? > > I would like to log that to our app's log > There isn't a suggested way of doing that right now. We could move things around and have a static String RXTXVersion.getNativeVersion() in future releases. Is this what you expected? This is not documented in commapi at all. I just tossed that in to catch conflicts while developing. It would be nice to have access in GUI applications though. It may be possible to access RXTXCommDriver.LibVersion right now. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Thu Apr 7 02:51:00 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 09:51:00 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> Message-ID: <4254F474.7020905@emation.pt> >There isn't a suggested way of doing that right now. We could move things >around and have a static String RXTXVersion.getNativeVersion() in future >releases. Is this what you expected? > > Yes, that would be perfect. >This is not documented in commapi at all. I just tossed that in to catch >conflicts while developing. It would be nice to have access in GUI >applications though. > >It may be possible to access RXTXCommDriver.LibVersion right now. > > > I tried, and I don't think it's possible. From taj at www.linux.org.uk Thu Apr 7 03:32:04 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 7 Apr 2005 10:32:04 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4254F474.7020905@emation.pt> References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: On Thu, 7 Apr 2005, Ricardo Trindade wrote: > > >There isn't a suggested way of doing that right now. We could move things > >around and have a static String RXTXVersion.getNativeVersion() in future > >releases. Is this what you expected? > > > > > > Yes, that would be perfect. > The attached should do what you want. You will still need to catch an exception for older versions... -- Trent Jarvi taj at www.linux.org.uk -------------- next part -------------- ? public_version.patch Index: RXTXCommDriver.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXCommDriver.java,v retrieving revision 1.16.2.51 diff -u -r1.16.2.51 RXTXCommDriver.java --- RXTXCommDriver.java 12 Oct 2004 09:13:30 -0000 1.16.2.51 +++ RXTXCommDriver.java 7 Apr 2005 09:29:04 -0000 @@ -54,7 +54,7 @@ the Library. */ String JarVersion = RXTXVersion.getVersion(); - String LibVersion = nativeGetVersion(); + String LibVersion = RXTXVersion.nativeGetVersion(); if ( devel ) { System.out.println("Devel Library"); @@ -76,7 +76,6 @@ /** Get the Serial port prefixes for the running OS */ private String deviceDirectory; private String osName; - private static native String nativeGetVersion(); private native boolean registerKnownPorts(int PortType); private native boolean isPortPrefixValid(String dev); private native boolean testRead(String dev, int type); Index: RXTXVersion.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXVersion.java,v retrieving revision 1.2.2.31 diff -u -r1.2.2.31 RXTXVersion.java --- RXTXVersion.java 16 Oct 2004 16:20:35 -0000 1.2.2.31 +++ RXTXVersion.java 7 Apr 2005 09:29:04 -0000 @@ -36,6 +36,7 @@ private static String Version; static { + System.loadLibrary( "rxtxSerial" ); Version = "RXTX-2.1-7pre20"; } /** @@ -47,4 +48,5 @@ { return(Version); } + public static native String nativeGetVersion(); } Index: SerialImp.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v retrieving revision 1.46.2.181 diff -u -r1.46.2.181 SerialImp.c --- SerialImp.c 17 Oct 2004 09:48:56 -0000 1.46.2.181 +++ SerialImp.c 7 Apr 2005 09:29:07 -0000 @@ -116,6 +116,7 @@ * It will eventually be removed. * */ #define RXTXPort(foo) Java_gnu_io_RXTXPort_ ## foo +#define RXTXVersion(foo) Java_gnu_io_RXTXVersion_ ## foo #define RXTXCommDriver(foo) Java_gnu_io_RXTXCommDriver_ ## foo #if defined(__sun__) || defined(__hpux__) @@ -4001,7 +4002,7 @@ } /*---------------------------------------------------------- -RXTXCommDriver.nativeGetVersion +RXTXVersion.nativeGetVersion accept: none perform: return the current version @@ -4010,9 +4011,10 @@ comments: This is used to avoid mixing versions of the .jar and native library. First introduced in rxtx-1.5-9 + Moved from RXTXCommDriver to RXTXVersion in rxtx-2.1-7 ----------------------------------------------------------*/ -JNIEXPORT jstring JNICALL RXTXCommDriver(nativeGetVersion) (JNIEnv *env, +JNIEXPORT jstring JNICALL RXTXVersion(nativeGetVersion) (JNIEnv *env, jclass jclazz ) { return (*env)->NewStringUTF( env, "RXTX-2.1-7pre20" ); From ricardo.trindade at emation.pt Thu Apr 7 03:45:58 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 10:45:58 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: <42550156.2040908@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050407/05212451/attachment-0163.html From thomas.shulok at lmco.com Thu Apr 7 17:43:11 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Thu, 07 Apr 2005 19:43:11 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi There, I'm attempting to talk RS232 between an embedded Linux box and a Windows box. Everything connects up fine, and I can send and receive a simple sequence of bytes with no problems. However, if around 5 seconds goes by without me sending something, I get the following when I attempt to send. java.io.IOException: Input/output error in writeArray Stack trace: java/lang/Throwable.()V java/lang/Throwable.(Ljava/lang/String;)V java/io/IOException.(Ljava/lang/String;)V gnu/io/RXTXPort.writeArray([BIIZ)V gnu/io/RXTXPort$SerialOutputStream.write([B)V SerialTest.main([Ljava/lang/String;)V If there interval is shorter (say 2 seconds between sends), I have no problems. On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and librxtxSerial-2.0.7pre2.so. Any ideas? Thanks, Thom -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5b23dcf/attachment-0163.html From taj at www.linux.org.uk Thu Apr 7 19:22:36 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:22:36 +0100 (BST) Subject: [Rxtx] Input/output error in writeArray In-Reply-To: References: Message-ID: On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a Windows > box. Everything connects up fine, and I can send and receive a simple > sequence of bytes with no problems. However, if around 5 seconds goes > by without me sending something, I get the following when I attempt to > send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Apr 7 19:24:59 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:24:59 +0100 (BST) Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) Message-ID: hmm. This would not work from applets would it? -- Trent Jarvi taj at www.linux.org.uk ---------- Forwarded message ---------- Date: Thu, 07 Apr 2005 16:05:53 -0400 From: Chris Gaffney To: taj at www.linux.org.uk Subject: RXTX Libraries on Classpath fix Hi, I submitted a patch for RXTX a few weeks ago to allow for loading the native libraries from the classpath. Since sending it to you I found it wasn't working on windows. I've fixed the problem and created a new patch that should replace the older one. The actual change is a one line from a String.equals() to a String.startsWith(). Thanks for a great piece of software, -Chris Gaffney Grand Valley State University -------------- next part -------------- A non-text attachment was scrubbed... Name: libraries_on_classpath_fixed.patch Type: text/x-patch Size: 5617 bytes Desc: Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5d423b8/libraries_on_classpath_fixed-0163.bin From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From thomas.shulok at lmco.com Fri Apr 8 10:38:55 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Fri, 08 Apr 2005 12:38:55 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi Trent, Thanks for the prompt response. Before diving deeper, I was wondering if there is a timeout parameter somewhere in the stack that I have not set properly. Given the nature of the failure (only fails if the line has been idle for a few seconds), it feels like some kind of timeout issue... Thanks again, Thom -----Original Message----- From: rxtx-bounces at mail.linuxgrrls.org [mailto:rxtx-bounces at mail.linuxgrrls.org] On Behalf Of Trent Jarvi Sent: Thursday, April 07, 2005 6:23 PM To: Java RXTX discussion Subject: Re: [Rxtx] Input/output error in writeArray On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a > Windows box. Everything connects up fine, and I can send and receive > a simple sequence of bytes with no problems. However, if around 5 > seconds goes by without me sending something, I get the following when > I attempt to send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk _______________________________________________ Rxtx mailing list Rxtx at mail.linuxgrrls.org http://mail.linuxgrrls.org/mailman/listinfo/rxtx From ricardo.trindade at emation.pt Mon Apr 4 09:17:23 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Mon, 04 Apr 2005 16:17:23 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot Message-ID: <42515A83.4050907@emation.pt> Hi, I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most recent stable snapshot), and get the following exception : It looks like rxtx has been compiled with jdk 1.5. If this was indeed the case, I think there is a compilation flag that generates code that runs on older jdks. java.lang.UnsupportedClassVersionError: gnu/io/UnsupportedCommOperationException (Unsupported major.minor version 49.0) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at java.net.URLClassLoader.defineClass(URLClassLoader.java:251) at java.net.URLClassLoader.access$100(URLClassLoader.java:55) at java.net.URLClassLoader$1.run(URLClassLoader.java:194) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:187) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:141) I'm trying to run it with 1.4. thanks Ricardo From taj at www.linux.org.uk Tue Apr 5 00:48:12 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 07:48:12 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42515A83.4050907@emation.pt> References: <42515A83.4050907@emation.pt> Message-ID: On Mon, 4 Apr 2005, Ricardo Trindade wrote: > Hi, > > I'm using rxtx-2.1-CVS-20050120-bins (which looks like the most > recent stable snapshot), and get the following exception : > > It looks like rxtx has been compiled with jdk 1.5. If this was > indeed the case, I think there is a compilation flag that generates code > that runs on older jdks. > > java.lang.UnsupportedClassVersionError: > gnu/io/UnsupportedCommOperationException (Unsupported major.minor > version 49.0) [snip] Thanks Ricardo I recompiled the jar with javac -source 1.3 -target 1.3. That should cover most of the JRE's in use today. I also compiled the rxtx 2.0 x86_64 native library which appeared to be missing. I tried looking for flags to pass gcc 4.0 to make the native libraries more backwards compatible but only found options for C++ which is not used in rxtx. I've got a list of other bugs that I'll be going through in the next few weeks but for now I just left them with the same CVS filename - no code changes. ftp://ftp.qbang.org/pub/rxtx/rxtx-2.0-CVS-20050120-bins.tar.gz ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-CVS-20050120-bins.tar.gz -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Tue Apr 5 02:24:33 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Tue, 05 Apr 2005 09:24:33 +0100 Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: References: <42515A83.4050907@emation.pt> Message-ID: <42524B41.3040300@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050405/5919abbb/attachment-0164.html From taj at www.linux.org.uk Tue Apr 5 03:00:29 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 10:00:29 +0100 (BST) Subject: [Rxtx] UnsupportedClassVersion on latest snapshot In-Reply-To: <42524B41.3040300@emation.pt> References: <42515A83.4050907@emation.pt> <42524B41.3040300@emation.pt> Message-ID: On Tue, 5 Apr 2005, Ricardo Trindade wrote: > Will you anounce to the list when a new release is available ? > There will be several incremental releases announced here. Once those are done, we will release 2.1.7 and 2.0.7. -- Trent Jarvi taj at www.linux.org.uk From no_spam at somewhere.com Tue Apr 5 11:55:37 2005 From: no_spam at somewhere.com (no_spam@somewhere.com) Date: Tue, 5 Apr 2005 13:55:37 -0400 Subject: [Rxtx] Closing a port from an event listener results in a deadlock Message-ID: <20050405175537.GA21747@rcog.homelinux.net> On the message I sent on March 14, does anyone had the chance to try the modification? Or was it already fixed? (I haven't searched the archive extensively) Or maybe my message got catched by some spam filters? (it made it to the list archive though) Anyway, I would appreciate some feedback (through the list) Thanks From taj at www.linux.org.uk Tue Apr 5 14:42:28 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Tue, 5 Apr 2005 21:42:28 +0100 (BST) Subject: [Rxtx] Closing a port from an event listener results in a deadlock In-Reply-To: <20050405175537.GA21747@rcog.homelinux.net> References: <20050405175537.GA21747@rcog.homelinux.net> Message-ID: On Tue, 5 Apr 2005 no_spam at somewhere.com wrote: > On the message I sent on March 14, does anyone had the chance to try the > modification? > > Or was it already fixed? (I haven't searched the archive extensively) > > Or maybe my message got catched by some spam filters? (it made it to the list > archive though) > > Anyway, I would appreciate some feedback (through the list) > The patch is here http://marc.theaimsgroup.com/?l=rxtx&m=111084488820288&w=2 I have applied this patch to a local copy but will not be doing formal testing for a couple weeks. I do not try to close ports from inside the eventListenter usually so I encourage any feedback also. If there are no problems reported, I expect this will go into rxtx 2.1-7. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Wed Apr 6 08:33:42 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Wed, 06 Apr 2005 15:33:42 +0100 Subject: [Rxtx] getting RXTX version Message-ID: <4253F346.50102@emation.pt> Hi, I want to make sure my deployments have the same version of RXTX jar and native lib. I know the version of the jar can be obtained in the Version class, but how can I obtain the native version ? I know RXTX prints to the console a warning if the version is different. Is there a way to programatically know is this is the case ? I would like to log that to our app's log thanks Ricardo From taj at www.linux.org.uk Wed Apr 6 15:10:20 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Wed, 6 Apr 2005 22:10:20 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4253F346.50102@emation.pt> References: <4253F346.50102@emation.pt> Message-ID: On Wed, 6 Apr 2005, Ricardo Trindade wrote: > Hi, > > I want to make sure my deployments have the same version of RXTX jar > and native lib. > > I know the version of the jar can be obtained in the Version class, > but how can I obtain the native version ? > > I know RXTX prints to the console a warning if the version is > different. Is there a way to programatically know is this is the case ? > > I would like to log that to our app's log > There isn't a suggested way of doing that right now. We could move things around and have a static String RXTXVersion.getNativeVersion() in future releases. Is this what you expected? This is not documented in commapi at all. I just tossed that in to catch conflicts while developing. It would be nice to have access in GUI applications though. It may be possible to access RXTXCommDriver.LibVersion right now. -- Trent Jarvi taj at www.linux.org.uk From ricardo.trindade at emation.pt Thu Apr 7 02:51:00 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 09:51:00 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> Message-ID: <4254F474.7020905@emation.pt> >There isn't a suggested way of doing that right now. We could move things >around and have a static String RXTXVersion.getNativeVersion() in future >releases. Is this what you expected? > > Yes, that would be perfect. >This is not documented in commapi at all. I just tossed that in to catch >conflicts while developing. It would be nice to have access in GUI >applications though. > >It may be possible to access RXTXCommDriver.LibVersion right now. > > > I tried, and I don't think it's possible. From taj at www.linux.org.uk Thu Apr 7 03:32:04 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Thu, 7 Apr 2005 10:32:04 +0100 (BST) Subject: [Rxtx] getting RXTX version In-Reply-To: <4254F474.7020905@emation.pt> References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: On Thu, 7 Apr 2005, Ricardo Trindade wrote: > > >There isn't a suggested way of doing that right now. We could move things > >around and have a static String RXTXVersion.getNativeVersion() in future > >releases. Is this what you expected? > > > > > > Yes, that would be perfect. > The attached should do what you want. You will still need to catch an exception for older versions... -- Trent Jarvi taj at www.linux.org.uk -------------- next part -------------- ? public_version.patch Index: RXTXCommDriver.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXCommDriver.java,v retrieving revision 1.16.2.51 diff -u -r1.16.2.51 RXTXCommDriver.java --- RXTXCommDriver.java 12 Oct 2004 09:13:30 -0000 1.16.2.51 +++ RXTXCommDriver.java 7 Apr 2005 09:29:04 -0000 @@ -54,7 +54,7 @@ the Library. */ String JarVersion = RXTXVersion.getVersion(); - String LibVersion = nativeGetVersion(); + String LibVersion = RXTXVersion.nativeGetVersion(); if ( devel ) { System.out.println("Devel Library"); @@ -76,7 +76,6 @@ /** Get the Serial port prefixes for the running OS */ private String deviceDirectory; private String osName; - private static native String nativeGetVersion(); private native boolean registerKnownPorts(int PortType); private native boolean isPortPrefixValid(String dev); private native boolean testRead(String dev, int type); Index: RXTXVersion.java =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXVersion.java,v retrieving revision 1.2.2.31 diff -u -r1.2.2.31 RXTXVersion.java --- RXTXVersion.java 16 Oct 2004 16:20:35 -0000 1.2.2.31 +++ RXTXVersion.java 7 Apr 2005 09:29:04 -0000 @@ -36,6 +36,7 @@ private static String Version; static { + System.loadLibrary( "rxtxSerial" ); Version = "RXTX-2.1-7pre20"; } /** @@ -47,4 +48,5 @@ { return(Version); } + public static native String nativeGetVersion(); } Index: SerialImp.c =================================================================== RCS file: /usr/local/cvsroot/rxtx-devel/src/SerialImp.c,v retrieving revision 1.46.2.181 diff -u -r1.46.2.181 SerialImp.c --- SerialImp.c 17 Oct 2004 09:48:56 -0000 1.46.2.181 +++ SerialImp.c 7 Apr 2005 09:29:07 -0000 @@ -116,6 +116,7 @@ * It will eventually be removed. * */ #define RXTXPort(foo) Java_gnu_io_RXTXPort_ ## foo +#define RXTXVersion(foo) Java_gnu_io_RXTXVersion_ ## foo #define RXTXCommDriver(foo) Java_gnu_io_RXTXCommDriver_ ## foo #if defined(__sun__) || defined(__hpux__) @@ -4001,7 +4002,7 @@ } /*---------------------------------------------------------- -RXTXCommDriver.nativeGetVersion +RXTXVersion.nativeGetVersion accept: none perform: return the current version @@ -4010,9 +4011,10 @@ comments: This is used to avoid mixing versions of the .jar and native library. First introduced in rxtx-1.5-9 + Moved from RXTXCommDriver to RXTXVersion in rxtx-2.1-7 ----------------------------------------------------------*/ -JNIEXPORT jstring JNICALL RXTXCommDriver(nativeGetVersion) (JNIEnv *env, +JNIEXPORT jstring JNICALL RXTXVersion(nativeGetVersion) (JNIEnv *env, jclass jclazz ) { return (*env)->NewStringUTF( env, "RXTX-2.1-7pre20" ); From ricardo.trindade at emation.pt Thu Apr 7 03:45:58 2005 From: ricardo.trindade at emation.pt (Ricardo Trindade) Date: Thu, 07 Apr 2005 10:45:58 +0100 Subject: [Rxtx] getting RXTX version In-Reply-To: References: <4253F346.50102@emation.pt> <4254F474.7020905@emation.pt> Message-ID: <42550156.2040908@emation.pt> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050407/05212451/attachment-0164.html From thomas.shulok at lmco.com Thu Apr 7 17:43:11 2005 From: thomas.shulok at lmco.com (Shulok, Thomas) Date: Thu, 07 Apr 2005 19:43:11 -0400 Subject: [Rxtx] Input/output error in writeArray Message-ID: Hi There, I'm attempting to talk RS232 between an embedded Linux box and a Windows box. Everything connects up fine, and I can send and receive a simple sequence of bytes with no problems. However, if around 5 seconds goes by without me sending something, I get the following when I attempt to send. java.io.IOException: Input/output error in writeArray Stack trace: java/lang/Throwable.()V java/lang/Throwable.(Ljava/lang/String;)V java/io/IOException.(Ljava/lang/String;)V gnu/io/RXTXPort.writeArray([BIIZ)V gnu/io/RXTXPort$SerialOutputStream.write([B)V SerialTest.main([Ljava/lang/String;)V If there interval is shorter (say 2 seconds between sends), I have no problems. On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and librxtxSerial-2.0.7pre2.so. Any ideas? Thanks, Thom -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5b23dcf/attachment-0164.html From taj at www.linux.org.uk Thu Apr 7 19:22:36 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:22:36 +0100 (BST) Subject: [Rxtx] Input/output error in writeArray In-Reply-To: References: Message-ID: On Thu, 7 Apr 2005, Shulok, Thomas wrote: > Hi There, > > I'm attempting to talk RS232 between an embedded Linux box and a Windows > box. Everything connects up fine, and I can send and receive a simple > sequence of bytes with no problems. However, if around 5 seconds goes > by without me sending something, I get the following when I attempt to > send. > > java.io.IOException: Input/output error in writeArray > > Stack trace: > java/lang/Throwable.()V > java/lang/Throwable.(Ljava/lang/String;)V > java/io/IOException.(Ljava/lang/String;)V > gnu/io/RXTXPort.writeArray([BIIZ)V > gnu/io/RXTXPort$SerialOutputStream.write([B)V > SerialTest.main([Ljava/lang/String;)V > > If there interval is shorter (say 2 seconds between sends), I have no > problems. > > On the Linux box, I'm running RXTXcomm-2.0-7pre2.jar and > librxtxSerial-2.0.7pre2.so. > > Any ideas? > > Thanks, > Thom > > I'm not aware of anything like this. What you may try doing is replacing rxtx with kermit or minicom to see if the problem is reproducable without rxtx. I'm assuming the OS just told rxtx the low level right resulted in an IO error. I'm not sure what rxtx can do as the C level write() is failing. Thats below rxtx. You can read about write() in "man 2 write." RXTX is getting an EIO from the system. Perhaps if the File Descriptor is being corrupted you will see that. You could do printf("filedescriptor = %i\n", fd); in SerialImp.c writArray and see if it changes. It should not change in theory. -- Trent Jarvi taj at www.linux.org.uk From taj at www.linux.org.uk Thu Apr 7 19:24:59 2005 From: taj at www.linux.org.uk (Trent Jarvi) Date: Fri, 8 Apr 2005 02:24:59 +0100 (BST) Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) Message-ID: hmm. This would not work from applets would it? -- Trent Jarvi taj at www.linux.org.uk ---------- Forwarded message ---------- Date: Thu, 07 Apr 2005 16:05:53 -0400 From: Chris Gaffney To: taj at www.linux.org.uk Subject: RXTX Libraries on Classpath fix Hi, I submitted a patch for RXTX a few weeks ago to allow for loading the native libraries from the classpath. Since sending it to you I found it wasn't working on windows. I've fixed the problem and created a new patch that should replace the older one. The actual change is a one line from a String.equals() to a String.startsWith(). Thanks for a great piece of software, -Chris Gaffney Grand Valley State University -------------- next part -------------- A non-text attachment was scrubbed... Name: libraries_on_classpath_fixed.patch Type: text/x-patch Size: 5617 bytes Desc: Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20050408/d5d423b8/libraries_on_classpath_fixed-0164.bin From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LPRPort.java > rxtx-2.1-7pre17-mod/src/LPRPort.java > > > --- rxtx-2.1-7pre17-orig/src/LPRPort.java???????2002-11-25 > 16:57:42.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LPRPort.java????????2005-02-26 > 13:27:55.000000000 -0500 > > > @@ -32,7 +32,7 @@ > > > ?{ > > > ? > > > ????????static { > > > -??????????????System.loadLibrary( "rxtxParallel" ); > > > +??????????????LibLoader.loadLibrary( "rxtxParallel" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/LibLoader.java > rxtx-2.1-7pre17-mod/src/LibLoader.java > > > --- rxtx-2.1-7pre17-orig/src/LibLoader.java?????1969-12-31 > 19:00:00.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/LibLoader.java??????2005-04-07 > 15:53:08.000000000 -0400 > > > @@ -0,0 +1,68 @@ > > > +/* > > > + * LibLoader.java > > > + * > > > + * Created on February 26, 2005, 1:03 PM > > > + */ > > > + > > > +package gnu.io; > > > + > > > +import java.net.URL; > > > +import java.util.HashSet; > > > +import java.util.Locale; > > > +import java.util.Set; > > > + > > > +/** > > > + * Package specific class for allowing the loading of libraries from > the > > > + * classpath. This class uses some RXTX specific conventions so it > would require > > > + * some modifications for use in other software. > > > + * @author Chris Gaffney > > > + */ > > > +class LibLoader { > > > + ???/** Set of loaded libaries. */ > > > + ???private static final Set loaded = new HashSet(); > > > + ??? > > > + ???/** This is a static class so lets not let it be instantiated. */ > > > + ???private LibLoader() {} > > > + ??? > > > + ???public static void loadLibrary(String lib) { > > > + ???????if(loaded.contains(lib)) { > > > + ???????????// Library is already loaded so just exit. > > > + ???????????return; > > > + ???????} > > > + ??????? > > > + ???????// Lets try to load the library. > > > + ???????try { > > > + ???????????// Try to load the library through regular channels. > > > + ???????????System.loadLibrary(lib); > > > + ???????} catch (UnsatisfiedLinkError e) { > > > + ???????????// Load has failed so we attempt to locate the library > > > + ???????????// on the classpath > > > + ???????????String fileName = lib + "."; > > > + ??????????? > > > + ???????????String os = > System.getProperty("os.name").toLowerCase(Locale.US); > > > + ???????????if(os.startsWith("windows")) { > > > + ???????????????// Windows. > > > + ???????????????fileName += "dll"; > > > + ???????????} else { > > > + ???????????????fileName = "lib" + fileName + "so"; > > > + ???????????} > > > + ??????????? > > > + ???????????URL libURL = ClassLoader.getSystemResource(fileName); > > > + ???????????//URL libURL = > getClass().getClassLoader().getResource(fileName); > > > + ??????????? > > > + ???????????if(libURL == null) { > > > + ???????????????// If we couldn't find it on the classpath so throw > the original > > > + ???????????????// exception. > > > + ???????????????throw e; > > > + ???????????} else { > > > + ???????????????// File exists so lets load it. If it fails then we > just let the > > > + ???????????????// exception be thrown to the parent class. > > > + ???????????????System.load(libURL.getFile()); > > > + ???????????} > > > + ???????} > > > + ??????? > > > + ???????// If we made it here then everything went well so mark the > library as > > > + ???????// loaded. > > > + ???????loaded.add(lib); > > > + ???} > > > +} > > > diff -Naur rxtx-2.1-7pre17-orig/src/RS485.java > rxtx-2.1-7pre17-mod/src/RS485.java > > > --- rxtx-2.1-7pre17-orig/src/RS485.java?2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/RS485.java??2005-02-26 13:28:09.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRS485" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRS485" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java > rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXCommDriver.java????????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXCommDriver.java?2005-02-26 > 13:28:27.000000000 -0500 > > > @@ -41,7 +41,7 @@ > > > ????????static > > > ????????{ > > > ???????????????if(debug ) System.out.println("RXTXCommDriver {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ? > > > ???????????????/* > > > ??????????????? ??Perform a crude check to make sure people don't mix > > > diff -Naur rxtx-2.1-7pre17-orig/src/RXTXPort.java > rxtx-2.1-7pre17-mod/src/RXTXPort.java > > > --- rxtx-2.1-7pre17-orig/src/RXTXPort.java??????2003-07-17 > 22:20:26.000000000 -0400 > > > +++ rxtx-2.1-7pre17-mod/src/RXTXPort.java???????2005-02-26 > 13:28:47.000000000 -0500 > > > @@ -51,7 +51,7 @@ > > > ? > > > ???????????????if(debug ) > > > ??????????????????????z.reportln( "RXTXPort {}"); > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > diff -Naur rxtx-2.1-7pre17-orig/src/Raw.java > rxtx-2.1-7pre17-mod/src/Raw.java > > > --- rxtx-2.1-7pre17-orig/src/Raw.java???2002-04-05 12:05:16.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/Raw.java????2005-02-26 13:29:05.000000000 > -0500 > > > @@ -32,7 +32,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxRaw" ); > > > +??????????????LibLoader.loadLibrary( "rxtxRaw" ); > > > ???????????????Initialize(); > > > ????????} > > > ? > > > _______________________________________________ > Rxtx mailing list > Rxtx at mail.linuxgrrls.org > http://mail.linuxgrrls.org/mailman/listinfo/rxtx > Dmitry Markman From dmarkman at mac.com Fri Apr 8 09:43:31 2005 From: dmarkman at mac.com (Dmitry Markman) Date: Fri, 8 Apr 2005 11:43:31 -0400 Subject: [Rxtx] RXTX Libraries on Classpath fix (fwd) In-Reply-To: References: Message-ID: <65b73d29e98d99e3dce95d6b707d8a20@mac.com> I think if RXTX is pre-installed it will work from applet (that could be a problem that dylib couldn't be unloaded on mac os x) On Apr 7, 2005, at 9:24 PM, Java RXTX discussion wrote: > > > hmm. ?This would not work from applets would it? > > > -- > Trent Jarvi > taj at www.linux.org.uk > > > ---------- Forwarded message ---------- > Date: Thu, 07 Apr 2005 16:05:53 -0400 > From: Chris Gaffney > To: taj at www.linux.org.uk > Subject: RXTX Libraries on Classpath fix > > > Hi, > > > I submitted a patch for RXTX a few weeks ago to allow for loading the > native libraries from the classpath. Since sending it to you I found > it > wasn't working on windows. I've fixed the problem and created a new > patch that should replace the older one. The actual change is a one > line > from a String.equals() to a String.startsWith(). > > > Thanks for a great piece of software, > -Chris Gaffney > Grand Valley State University > diff -Naur rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java > rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java > > > --- rxtx-2.1-7pre17-orig/src/CommPortIdentifier.java????2003-02-18 > 06:51:20.000000000 -0500 > > > +++ rxtx-2.1-7pre17-mod/src/CommPortIdentifier.java?????2005-02-26 > 13:35:02.000000000 -0500 > > > @@ -80,7 +80,7 @@ > > > ??????????????????????if (debug) > > > ?????????????????????????????System.out.println("Have not implemented > native_psmisc_report_owner(PortName)); in CommPortIdentifier"); > > > ???????????????} > > > -??????????????System.loadLibrary( "rxtxSerial" ); > > > +??????????????LibLoader.loadLibrary( "rxtxSerial" ); > > > ????????} > > > ????????CommPortIdentifier ( String pn, CommPort cp, int pt, > CommDriver driver) > > > ????????{ > > > diff -Naur rxtx-2.1-7pre17-orig/src/I2C.java > rxtx-2.1-7pre17-mod/src/I2C.java > > > --- rxtx-2.1-7pre17-orig/src/I2C.java???2002-04-05 12:05:15.000000000 > -0500 > > > +++ rxtx-2.1-7pre17-mod/src/I2C.java????2005-02-26 13:27:16.000000000 > -0500 > > > @@ -35,7 +35,7 @@ > > > ? > > > ????????static > > > ????????{ > > > -??????????????System.loadLibrary( "rxtxI2C" ); > > > +??????????????LibLoader.loadLibrary( "rxtxI2C" ); > > > ??